很多shell 通过grep取出文本, 正则替换再输出。 正确的是sed。 通过s 命令: echo Tom like Jerry. Tom hats Jerry. > kan.txt sed 's/Tom/Kan' < kan.txt Kan like Jerry. Tom hats Jerry. ...
分类:
其他好文 时间:
2020-05-19 15:01:29
阅读次数:
55
https://leetcode-cn.com/problems/rearrange-words-in-a-sentence/ 非常简单的题目,首先先将字符串按照空格进行分割,然后将第一个字符串的首字母转成小写。 然后对字符串数组进行排序,按照字符串的长度进行排序,因为题目要求要保持原有的顺序,所以 ...
分类:
其他好文 时间:
2020-05-18 14:27:19
阅读次数:
40
对应java代码:packagecom.yoooya.ytp.utils.doc;importcom.aspose.words.Document;importcom.aspose.words.License;importcom.aspose.words.SaveFormat;importcom.yoooya.ytp.utils.DateUtils;importcom.yoooya.ytp.util
分类:
编程语言 时间:
2020-05-16 10:46:26
阅读次数:
66
Come on –Everybody’s doing it. That whispered message, half invitation and half forcing, is what most of us think of when we hear the words peer press ...
分类:
其他好文 时间:
2020-05-12 16:51:44
阅读次数:
126
滑动窗口法 思路: 由于给定words列表中每个单词长度是一样的,则我们可以通过单词个数乘以长度得到要比对子串的长度,然后在原始字符串不断滑动比对。找到每个子串后,可以将子串按照单词长度拆分变成数组,只需要比对拆分后的数组中元素是否和words中一致即可。 代码: class Solution: d ...
分类:
其他好文 时间:
2020-05-12 13:33:25
阅读次数:
55
1.IMDB数据集 下载 imdb=keras.datasets.imdb (train_x, train_y), (test_x, text_y)=keras.datasets.imdb.load_data(num_words=10000) 了解IMDB数据 print("Training ent ...
分类:
其他好文 时间:
2020-05-12 12:03:44
阅读次数:
146
1.分词 #DreaminRedMansions.py import jieba #调用jieba库 txt = open("D:\Download\lianxii\passageone.txt","r",encoding="UTF-8").read() #打开txt文件阅读 words = jie ...
分类:
其他好文 时间:
2020-05-06 19:52:48
阅读次数:
55
题目描述: import java.util.TreeSet; class Solution { public int uniqueMorseRepresentations(String[] words) { String[] codes = {".-","-...","-.-.","-..",". ...
分类:
其他好文 时间:
2020-05-04 23:05:22
阅读次数:
74
题目描述: 方法一:记忆化递归+状态压缩 * from functools import lru_cache class Solution: def numberWays(self, hats: List[List[int]]) -> int: N = len(hats) M = 41 mod = ...
分类:
其他好文 时间:
2020-05-03 21:35:02
阅读次数:
85
2020-05-03 09:28:14 问题描述: 总共有 n 个人和 40 种不同的帽子,帽子编号从 1 到 40 。 给你一个整数列表的列表 hats ,其中 hats[i] 是第 i 个人所有喜欢帽子的列表。 请你给每个人安排一顶他喜欢的帽子,确保每个人戴的帽子跟别人都不一样,并返回方案数。 ...
分类:
其他好文 时间:
2020-05-03 10:45:21
阅读次数:
52