diff --git a/1901100103/1001S02E01_helloworld.txt b/1901100103/1001S02E01_helloworld.txt deleted file mode 100644 index 70c379b63..000000000 --- a/1901100103/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world \ No newline at end of file diff --git a/1901100103/1001S02E02_hello_python.py b/1901100103/1001S02E02_hello_python.py deleted file mode 100644 index 00950d9ac..000000000 --- a/1901100103/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print('hello world') \ No newline at end of file diff --git a/1901100103/README.md b/1901100103/README.md deleted file mode 100644 index c5c452c8e..000000000 --- a/1901100103/README.md +++ /dev/null @@ -1 +0,0 @@ -# learn markdown \ No newline at end of file diff --git a/1901100304/1001S02E01_helloword.txt b/1901100304/1001S02E01_helloword.txt deleted file mode 100644 index 40d8cf85d..000000000 --- a/1901100304/1001S02E01_helloword.txt +++ /dev/null @@ -1 +0,0 @@ -hello word \ No newline at end of file diff --git a/1901100304/README.md b/1901100304/README.md deleted file mode 100644 index 0e6a3b9fc..000000000 --- a/1901100304/README.md +++ /dev/null @@ -1 +0,0 @@ -learn markdown diff --git a/1901100373/1001S02E02_hello_python.py b/1901100373/1001S02E02_hello_python.py deleted file mode 100644 index 75d9766db..000000000 --- a/1901100373/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print('hello world') diff --git a/exercises/1901010072/1001S02E05_array.py b/exercises/1901010072/1001S02E05_array.py index 311ffc85a..2b0f24bc4 100644 --- a/exercises/1901010072/1001S02E05_array.py +++ b/exercises/1901010072/1001S02E05_array.py @@ -1,25 +1,33 @@ -# 将数组 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 翻转 -a_list =[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -list(iterable) -for i in a: -print(i,reverse=True) -a_list.reverse() -# 翻转后的数组拼接成字符串 -s='' -s.join(a) -# ⽤字符串切片的方式取出第三到第⼋个字符(包含第三和第⼋个字符) -print(a_list[3:9]) -# 将获得的字符串进行翻转 -b=a_list[3:9].reverse() -print(b) -# 将结果转换为 int 类型 -c=int(b) -print(c) -# 分别转换成⼆进制,⼋进制,十六进制 -d=bin(int(c, 2)) -e=oct(int(c, 2)) -f=hex(int(c, 2)) -# 最后输出三种进制的结果 -print(d) -print(e) -print(f) \ No newline at end of file + +# 1.对列表 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 翻转 +sample_list =[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +reverse_list=sample_list[::-1] +print('列表翻转==>',reverse_list) + +# 2.翻转后的列表拼接成字符串 +#调用''(空字符串)str类型的join方法可以连接列表里的元素,用''(空字符串)表示连接的时候元素间不用任何字符隔开 +#因为reverse_list里面都是int类型元素,所以拼接之前要把reverse_list变成一个包含str类型元素的列表 +joined_str = ''.join([str(i) for i in reverse_list]) +print('翻转后的数组接拼成字符串-->',joined_str) + +# 3.⽤字符串切片的方式取出第三到第⼋个字符(包含第三和第⼋个字符) +# 切片的时候包含开始索引,不包含结尾的索引 +slice_str=joined_str[2:8] +print('用字符串切片的方式取出第三到第八个字符-->',sliced_str) + +# 4.将获得的字符串进行翻转 + +reversed_str=sliced_str[::-1] +print('字符串翻转-->',reversed_str) + +# 5.将结果转换为 int 类型 +int_value=int(reversed_str) +print('转换为 int 类型-->',int_value) + +# 6.分别转换成⼆进制,⼋进制,十六进制 + +print('转换为二进制==>',bin(int_value)) +print('转换为八进制==>',oct(int_value)) +print('转换为十六进制==>',hex(int_value)) + + diff --git a/exercises/1901010072/1001S02E05_state_text.py b/exercises/1901010072/1001S02E05_state_text.py index e61aa7815..43a26db07 100644 --- a/exercises/1901010072/1001S02E05_state_text.py +++ b/exercises/1901010072/1001S02E05_state_text.py @@ -1,4 +1,6 @@ -text = ''' + +sample_text = ''' + The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. @@ -21,12 +23,41 @@ If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! ''' -# 使用字典(dict)统计字符串样本text中各个英文单词出现的次数 -# 按照出现次数从⼤到⼩输出所有的单词及出现的次数 -# 只统计英文单词,不包括⾮、非英⽂字符的其他任何符号,如连接符号、空白字符等 -s=text -s.strip() -for k in s: - v = str.count(k) -dict=dict_items([k,v]) -sorted(dict,reverse=true) \ No newline at end of file + +# 1.使用字典(dict)统计字符串样本text中各个英文单词出现的次数 +# 先将字符串根据 空白字符 分割成list,在调用str类型 +elements = sample_text.split() +# 定义一个新的list类型变量,存储处理过的单词 +words=[] +#先针对样本文本挑选出需要提出的非单词符号 +symbols=',.*-!' +for element elements: + #遍历一遍要剔除的符号 + for symbol in symbols: + #逐个替换字符号,用''是为了同时剔除符号所占的位置 + element=elements.replace(symbol,'') + #剔除了字符后如果element的长度不为0,则算作正常单词 + if len(element): + words.append(element) +print('正常的英文单词==>',words) + +#初始化一个dict(字典)类型的数量,用来存放单词出现的次数 +count={} + +#set(集合)类型可以去掉列表里的重复元素,可以在for...in里减少循环次数 +word_set=set(words) + +for word in word_set: + counter[word]=words.count(word) + +print('英文单词出现的次数==>',counter) + +# 2.按照出现次数从⼤到⼩输出所有的单词及出现的次数 + +#内置函数sorted的参数key表示按元素的那一项的值进行排序 +#dict类型counter的items方法会返回一个包含相应项(key,value)的元组列表 +#print('counter.items()==>',counter.items()) + +print('从大到小输出所有的单词及出现的次数==>',sorted(counter.items(),key=lamda x:x[1],reverse=True)) + + diff --git a/exercises/1901010072/1001S02E05_string.py b/exercises/1901010072/1001S02E05_string.py index fe1975165..1640cc4a8 100644 --- a/exercises/1901010072/1001S02E05_string.py +++ b/exercises/1901010072/1001S02E05_string.py @@ -1,4 +1,6 @@ -text = ''' + +sample_text = ''' + The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. @@ -22,22 +24,28 @@ Namespaces are one honking great idea -- let's do more of those! ''' #第一步将字符串样本text里的better全部替换成worse -s=text -s.replace('better', 'worse', ) -print(s.replace('better', 'worse', )) + +#调用str类型的replace方法进行替换 +text=sample_text.replace('better','worse') +print('将字符串样本里的better全部替换成worse ==>', text) #第二步将单词中包含ea的单词剔除 -s.split() -L = list(s) -for C in L: - if 'ea' in 'C', - del L[C] - print(L_list) -else: - print(L_list) +#先将字符串根据 空白字符 分割成 list,在调用str类型 +words = text.split() +#定义一个list类型的变量用来存放过滤完的单词 +filtered = [] +#用 for...in 循环遍历一遍words里的元素然后判断单词是否包含ea +for word in words: + #str类型的find方法涂过不包含参数字符则返回-1,如果包含则返回该字符第一次出现时的索引 + if word.find('ea')<0: + filtered.append(word) +print('将单词中包含ea的单词剔除==>',filtered) #第三步将字⺟进行⼤小写翻转 -s.swapcase() +#利用列表推导式对str类型的元素进行大小写翻转 +swapcasd=[i.swapcase()for i in filtered] +print('进行大小写翻转-->',swapcased) #第四步将单词升序排列 -L_list.sort() \ No newline at end of file +print('单词按a...z升序排列-->',sorted(swapcased)) +#print('单词按a...z降序排列-->',sorted(swapcased,reverse=true)) diff --git a/exercises/1901100024/1001S02E06_stats_word.py b/exercises/1901010072/1001S02E06_stats_word.py similarity index 50% rename from exercises/1901100024/1001S02E06_stats_word.py rename to exercises/1901010072/1001S02E06_stats_word.py index b32e4dbbf..4bbab210a 100644 --- a/exercises/1901100024/1001S02E06_stats_word.py +++ b/exercises/1901010072/1001S02E06_stats_word.py @@ -1,4 +1,36 @@ -en_text = ''' +# 统计参数中每个英文单词出现的次数 +def stats_text_en(text): + elements=text.split() + words=[] + symbols=',.*-!' + for element in elements: + for symbol in symbols: + element = element.replace(symbol,'') + if len(element): + words.append(element) + counter={} + word_set=set(words) + + for word in word_set: + counter[word]=words.count(word) + #函数返回值用return进行返回,如果没有return返回值则为None + return sorted(counter.items(),key=lambda x:x[1],reverse=True) + +# 统计参数中每个中文单词出现的次数 +def stats_text_cn(text): + cn_characters=[] + for character in text: + #unicode中中文字符的范围 + if '\u4e00'<=character<='\u9fff': + cn_characters.append(character) + counter={} + cn_character_set=set(cn_characters) + for character in cn_character_set: + counter[character]=cn_characters.count(character) + return sorted(counter.items(),key=lambda x:x[1],reverse=True) + + +en_text=''' The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. @@ -12,54 +44,16 @@ Errors should never pass silently. Unless explicitly silenced. In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. +There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. +Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! ''' - -def stats_text_en(text): - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - if len(element): - words.append(element) - counter = {} - word_set = set(words) - - - - for word in word_set: - counter[word] = words.count(word) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - - - - def stats_text_cn(text): - cn_characters = [] - for character in text: - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - counter = {} - cn_character_set = set(cn_characters) - for character in cn_character_set: - counter[character] = cn_characters.count(character) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - - -cn_text = ''' +cn_text=''' Python之禅 by Tim Peters - 优美胜于丑陋 明了胜于晦涩 简洁胜于复杂 @@ -73,11 +67,14 @@ def stats_text_cn(text): 而是尽量找一种,最好是唯一一种明显的解决方案 虽然这并不容易,因为你不是 Python 之父 做也许好过不做,但不假思索就动手还不如不做 -。。。 +如果你无法向人描述你的方案,那肯定不是一个好方案;反之亦然 +命名空间是一种绝妙的理念,我们应当多加利用。。。 ''' -if __name__ == '__main__': - en_result = stats_text_en(en_text) - cn_result = stats_text_en(cn_text) - print('统计参数中每个英语单词出现的次数 ==>\n',en_result) - print('统计参数中每个中文汉字出现的次数 ==>\n',cn_result) +#搜索__name__==__main}__ +#一般情况下在文件内测试代码的时候以下面的形式进行 +if __name__=='__main__': + en_result=stats_text_en(en_text) + cn_result=stats_text_cn(cn_text) + print('统计参数中每个英文单词出现的次数 ==>\n',en_result) + print('统计参数中每个中文汉字出现的次数==>\n',cn_result) \ No newline at end of file diff --git a/exercises/1901110099/d07/main.py b/exercises/1901010072/d07/main.py.py similarity index 54% rename from exercises/1901110099/d07/main.py rename to exercises/1901010072/d07/main.py.py index b1774747d..6150d7b82 100644 --- a/exercises/1901110099/d07/main.py +++ b/exercises/1901010072/d07/main.py.py @@ -1,46 +1,47 @@ from mymodule import stats_word -new_text = ''' +sample_text = ''' 愚公移⼭ -太行,王屋⼆山的北面,住了一個九十歲的⽼翁,名叫愚公。⼆山佔地廣闊,擋住去路,使他和家⼈往來來極為不便。 -⼀天,愚公召集家人說:「讓我們各盡其力,剷平⼆山,開條道路,直通豫州,你們認為怎樣?」 -⼤家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個⼩丘的力量量都沒有,怎可能剷平太行、王屋⼆山呢?況且,鑿出的⼟石⼜丟到哪裏去呢?」 -⼤家都熱烈烈地說:「把⼟石丟進渤海裏。」 -於是愚公就和兒孫,⼀一起開挖土,把⼟⽯搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子⼋歲也興致勃勃地走來幫忙。 -寒來暑往,他們要⼀年才能往返渤海一次。 -住⿈河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」 -愚公歎息道:「你有這樣的成見,是不會明⽩的。你比那寡婦的小兒⼦子還不不如呢!就算我死了,還有我的兒⼦,我的孫子,我的曾孫子,他們一直傳下去。⽽這⼆山是不會加大的,總有 -一天,我們會把它們剷平。」 -智叟聽了,無話可說: -⼆山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤力神揹⾛二⼭。 +太行,王屋⼆山的北面,住了一個九十歲的⽼翁,名叫愚公。⼆山佔地廣闊,擋住去路路,使他 +和家⼈往來極為不便。 +⼀天,愚公召集家⼈人說:「讓我們各盡其力,剷平⼆山,開條道路,直通豫州,你們認為怎 +樣?」 +⼤家都異異⼝同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個⼩丘的⼒量都沒有,怎 +可能剷平太行、王屋⼆山呢?況且,鑿出的⼟石⼜丟到哪裏去呢?」 +⼤家都熱烈地說:「把⼟石丟進渤海海裏。」 +於是愚公就和兒孫,⼀起開挖土,把⼟石搬運到渤海去。 +愚公的鄰居是個寡婦,有個兒⼦八歲也興致勃地⾛來幫忙。 +寒來暑往,他們要一年才能往返渤海一次。 +住在⿈河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀 +了,就是⽤盡你的氣力,也不能挖去山的一角呢?」 +愚公歎息道:「你有這樣的成見,是不會明白的。你⽐那寡婦的⼩兒子還不如呢!就算我死 +了,還有我的兒子,我的孫⼦,我的曾孫⼦,他們一直傳下去。⽽這⼆山是不會加大的,總有 +⼀天,我們會把它們剷平。」 +智叟聽了,無話可說: +⼆山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤ +力神揹走⼆山。 + How The Foolish Old Man Moved Mountains Yugong was a ninety-year-old man who lived at the north of two high mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” +Stretching over a wide expanse of land, the mountains blocked yugong’s way making it inconvenient for him and his family to get around. +One day yugong gathered his family together and said,”Let’s do our best to level these two mountains. We shall open a road that leads to Yuzhou. What do you think?” All but his wife agreed with him. “You don’t have the strength to cut even a small mound,” muttered his wife. “How on earth do you suppose you can level Mount Taixin and Mount Wanwu? Moreover, where will all the earth and rubble go?” “Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea -of Bohai. +So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. Now Yugong’s neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” +On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed Yugong saying,”Aren’t you foolish, my friend? You are very old now, +and with whatever remains of your waning strength, you won’t be able to remove even a corner of the mountain.” Yugong uttered a sigh and said,”A biased person like you will never understand. You can’t even compare with the widow’s little boy!” “Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with -confidence. +They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. +When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. ''' -result = stats_word.stats_text(new_text) +result = stats_word.stats_text(sample_text) -print(result) \ No newline at end of file +print('统计结果==>',result) \ No newline at end of file diff --git a/exercises/1901010072/d07/mymodule/stats_word.py b/exercises/1901010072/d07/mymodule/stats_word.py new file mode 100644 index 000000000..38e14dba6 --- /dev/null +++ b/exercises/1901010072/d07/mymodule/stats_word.py @@ -0,0 +1,112 @@ +text = ''' +愚公移⼭ +太行,王屋⼆山的北面,住了一個九十歲的⽼翁,名叫愚公。⼆山佔地廣闊,擋住去路路,使他 +和家⼈往來極為不便。 +⼀天,愚公召集家⼈人說:「讓我們各盡其力,剷平⼆山,開條道路,直通豫州,你們認為怎 +樣?」 +⼤家都異異⼝同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個⼩丘的⼒量都沒有,怎 +可能剷平太行、王屋⼆山呢?況且,鑿出的⼟石⼜丟到哪裏去呢?」 +⼤家都熱烈地說:「把⼟石丟進渤海海裏。」 +於是愚公就和兒孫,⼀起開挖土,把⼟石搬運到渤海去。 +愚公的鄰居是個寡婦,有個兒⼦八歲也興致勃地⾛來幫忙。 +寒來暑往,他們要一年才能往返渤海一次。 +住在⿈河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀 +了,就是⽤盡你的氣力,也不能挖去山的一角呢?」 +愚公歎息道:「你有這樣的成見,是不會明白的。你⽐那寡婦的⼩兒子還不如呢!就算我死 +了,還有我的兒子,我的孫⼦,我的曾孫⼦,他們一直傳下去。⽽這⼆山是不會加大的,總有 +⼀天,我們會把它們剷平。」 +智叟聽了,無話可說: +⼆山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤ +力神揹走⼆山。 + +How The Foolish Old Man Moved Mountains +Yugong was a ninety-year-old man who lived at the north of two high +mountains, Mount Taixing and Mount Wangwu. +Stretching over a wide expanse of land, the mountains blocked +yugong’s way making it inconvenient for him and his family to get +around. +One day yugong gathered his family together and said,”Let’s do our +best to level these two mountains. We shall open a road that leads +to Yuzhou. What do you think?” +All but his wife agreed with him. +“You don’t have the strength to cut even a small mound,” muttered +his wife. “How on earth do you suppose you can level Mount Taixin +and Mount Wanwu? Moreover, where will all the earth and rubble go?” +“Dump them into the Sea of Bohai!” said everyone. +So Yugong, his sons, and his grandsons started to break up rocks and +remove the earth. They transported the earth and rubble to the Sea +of Bohai. +Now Yugong’s neighbour was a widow who had an only child eight years +old. Evening the young boy offered his help eagerly. +Summer went by and winter came. It took Yugong and his crew a full +year to travel back and forth once. +On the bank of the Yellow River dwelled an old man much respected +for his wisdom. When he saw their back-breaking labour, he ridiculed +Yugong saying,”Aren’t you foolish, my friend? You are very old now, +and with whatever remains of your waning strength, you won’t be able +to remove even a corner of the mountain.” +Yugong uttered a sigh and said,”A biased person like you will never +understand. You can’t even compare with the widow’s little boy!” +“Even if I were dead, there will still be my children, my +grandchildren, my great grandchildren, my great great grandchildren. +They descendants will go on forever. But these mountains will not +grow any taler. We shall level them one day!” he declared with +confidence. +The wise old man was totally silenced. +When the guardian gods of the mountains saw how determined Yugong +and his crew were, they were struck with fear and reported the +incident to the Emperor of Heavens. +Filled with admiration for Yugong, the Emperor of Heavens ordered +two mighty gods to carry the mountains away. +''' + +# 统计参数中每个英文单词出现的次数 +def stats_text_en(text): + elements=text.split() + words=[] + symbols=',.*-!' + for element in elements: + for symbol in symbols: + element = element.replace(symbol,'') + # 用str 类型的 isascii 方法判断是否是英文单词 + if len(element) and element.isascii(): + words.append(element) + counter={} + word_set=set(words) + + for word in word_set: + counter[word]=words.count(word) + #函数返回值用return进行返回,如果没有return返回值则为None + return sorted(counter.items(),key=lambda x:x[1],reverse=True) + +# 统计参数中每个中文单词出现的次数 +def stats_text_cn(text): + cn_characters=[] + for character in text: + #unicode中中文字符的范围 + if '\u4e00'<=character<='\u9fff': + cn_characters.append(character) + counter={} + cn_character_set=set(cn_characters) + for character in cn_character_set: + counter[character]=cn_characters.count(character) + return sorted(counter.items(),key=lambda x:x[1],reverse=True) + +# 添加名为 stats_text的函数,实现功能:分别调用stats_text_en , stats_text_cn ,输出合并词频统计结果 + +def stats_text(text): + """ + Return a list of frequency of each English alphabet and Chinese characters, + Sorted in descending order. + 合并 英文词频和中文词频 的结果 + """ + return stats_text_en(text)+stats_text_cn(text) + + +#搜索 _name_ == '_main_' +#一般情况下在文件内测试代码的时候以下面的形式进行 +if __name__=='__main__': + en_text=''' +the Zen of Python, by Tim Peters + + diff --git a/exercises/1901010072/d08/main.py.py b/exercises/1901010072/d08/main.py.py new file mode 100644 index 000000000..50c352e87 --- /dev/null +++ b/exercises/1901010072/d08/main.py.py @@ -0,0 +1,67 @@ +from mymodule import stats_word +import traceback +import logging + +logger = logging. getlogger(__name__) + +def test_traceback(): + try: + stats_word.stats_text(1) + except Exception as e: + print('test_traceback =>',e) + print(traceback.format_exc()) + +def test_logger(): + try: + stats_word.stats_text(1) + except Exception as e: + #print('test_logger =>',e) + logger.exception(e) + +if __name__=="__main__": + #stats_word.stats_text(1) + test_traceback() + test_logger() + + +text = ''' +愚公移⼭ +太行,王屋⼆山的北面,住了一個九十歲的⽼翁,名叫愚公。⼆山佔地廣闊,擋住去路路,使他 +和家⼈往來極為不便。 +⼀天,愚公召集家⼈人說:「讓我們各盡其力,剷平⼆山,開條道路,直通豫州,你們認為怎 +樣?」 +⼤家都異異⼝同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個⼩丘的⼒量都沒有,怎 +可能剷平太行、王屋⼆山呢?況且,鑿出的⼟石⼜丟到哪裏去呢?」 +⼤家都熱烈地說:「把⼟石丟進渤海海裏。」 +於是愚公就和兒孫,⼀起開挖土,把⼟石搬運到渤海去。 +愚公的鄰居是個寡婦,有個兒⼦八歲也興致勃地⾛來幫忙。 +寒來暑往,他們要一年才能往返渤海一次。 +住在⿈河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀 +了,就是⽤盡你的氣力,也不能挖去山的一角呢?」 +愚公歎息道:「你有這樣的成見,是不會明白的。你⽐那寡婦的⼩兒子還不如呢!就算我死 +了,還有我的兒子,我的孫⼦,我的曾孫⼦,他們一直傳下去。⽽這⼆山是不會加大的,總有 +⼀天,我們會把它們剷平。」 +智叟聽了,無話可說: +⼆山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤ +力神揹走⼆山。 + +How The Foolish Old Man Moved Mountains +Yugong was a ninety-year-old man who lived at the north of two high mountains, Mount Taixing and Mount Wangwu. +Stretching over a wide expanse of land, the mountains blocked yugong’s way making it inconvenient for him and his family to get around. +One day yugong gathered his family together and said,”Let’s do our best to level these two mountains. We shall open a road that leads to Yuzhou. What do you think?” +All but his wife agreed with him. +“You don’t have the strength to cut even a small mound,” muttered his wife. “How on earth do you suppose you can level Mount Taixin +and Mount Wanwu? Moreover, where will all the earth and rubble go?” +“Dump them into the Sea of Bohai!” said everyone. +So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. +Now Yugong’s neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. +Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. +On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed Yugong saying,”Aren’t you foolish, my friend? You are very old now, +and with whatever remains of your waning strength, you won’t be able to remove even a corner of the mountain.” +Yugong uttered a sigh and said,”A biased person like you will never understand. You can’t even compare with the widow’s little boy!” +“Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. +They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. +The wise old man was totally silenced. +When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. +Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. +''' \ No newline at end of file diff --git a/exercises/1901010072/d08/mymodule/stats_word.py b/exercises/1901010072/d08/mymodule/stats_word.py new file mode 100644 index 000000000..40818e7a6 --- /dev/null +++ b/exercises/1901010072/d08/mymodule/stats_word.py @@ -0,0 +1,84 @@ +text = ''' +愚公移⼭ +太行,王屋⼆山的北面,住了一個九十歲的⽼翁,名叫愚公。⼆山佔地廣闊,擋住去路路,使他和家⼈往來極為不便。 +⼀天,愚公召集家⼈人說:「讓我們各盡其力,剷平⼆山,開條道路,直通豫州,你們認為怎樣?」 +⼤家都異異⼝同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個⼩丘的⼒量都沒有,怎可能剷平太行、王屋⼆山呢?況且,鑿出的⼟石⼜丟到哪裏去呢?」 +⼤家都熱烈地說:「把⼟石丟進渤海海裏。」 +於是愚公就和兒孫,⼀起開挖土,把⼟石搬運到渤海去。愚公的鄰居是個寡婦,有個兒⼦八歲也興致勃地⾛來幫忙。 +寒來暑往,他們要一年才能往返渤海一次。 +住在⿈河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是⽤盡你的氣力,也不能挖去山的一角呢?」 +愚公歎息道:「你有這樣的成見,是不會明白的。你⽐那寡婦的⼩兒子還不如呢!就算我死了,還有我的兒子,我的孫⼦,我的曾孫⼦,他們一直傳下去。⽽這⼆山是不會加大的,總有 +⼀天,我們會把它們剷平。」 +智叟聽了,無話可說: +⼆山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤力神揹走⼆山。 + +How The Foolish Old Man Moved Mountains +Yugong was a ninety-year-old man who lived at the north of two highmountains, Mount Taixing and Mount Wangwu. +Stretching over a wide expanse of land, the mountains blocked yugong’s way making it inconvenient for him and his family to get around. +One day yugong gathered his family together and said,”Let’s do our best to level these two mountains. We shall open a road that leads +to Yuzhou. What do you think?” +All but his wife agreed with him. +“You don’t have the strength to cut even a small mound,” muttered his wife. “How on earth do you suppose you can level Mount Taixin +and Mount Wanwu? Moreover, where will all the earth and rubble go?” +“Dump them into the Sea of Bohai!” said everyone. So Yugong, his sons, and his grandsons started to break up rocks and +remove the earth. They transported the earth and rubble to the Sea of Bohai. Now Yugong’s neighbour was a widow who had an only child eight years +old. Evening the young boy offered his help eagerly. +Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. +On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed +Yugong saying,”Aren’t you foolish, my friend? You are very old now, and with whatever remains of your waning strength, you won’t be able +to remove even a corner of the mountain.” +Yugong uttered a sigh and said,”A biased person like you will never understand. You can’t even compare with the widow’s little boy!” +“Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. +They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. +The wise old man was totally silenced. +When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. +Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. +''' + +# 统计参数中每个英文单词出现的次数 +def stats_text_en(text): + elements=text.split() + words=[] + symbols=',.*-!' + for element in elements: + for symbol in symbols: + element = element.replace(symbol,'') + # 用str 类型的 isascii 方法判断是否是英文单词 + if len(element) and element.isascii(): + words.append(element) + counter={} + word_set=set(words) + + for word in word_set: + counter[word]=words.count(word) + #函数返回值用return进行返回,如果没有return返回值则为None + return sorted(counter.items(),key=lambda x:x[1],reverse=True) + +# 统计参数中每个中文单词出现的次数 +def stats_text_cn(text): + cn_characters=[] + for character in text: + #unicode中中文字符的范围 + if '\u4e00'<=character<='\u9fff': + cn_characters.append(character) + counter={} + cn_character_set=set(cn_characters) + for character in cn_character_set: + counter[character]=cn_characters.count(character) + return sorted(counter.items(),key=lambda x:x[1],reverse=True) + +# 添加名为 stats_text的函数,实现功能:分别调用stats_text_en , stats_text_cn ,输出合并词频统计结果 + +def stats_text(text): + """ + Return a list of frequency of each English alphabet and Chinese characters, + Sorted in descending order. + 合并 英文词频和中文词频 的结果 + """ + return stats_text_en(text)+stats_text_cn(text) + + +try: + f = open('stats_text.txt', 'r') +except FileNotFoundError as fnf_error: + print(fnf_error) diff --git a/exercises/1901010072/d09/main.py.py b/exercises/1901010072/d09/main.py.py new file mode 100644 index 000000000..448e8c25c --- /dev/null +++ b/exercises/1901010072/d09/main.py.py @@ -0,0 +1,48 @@ +from mymodule import stats_word +from os import path +import json +import re +import logging + +logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG) + +def load_file(): + ''' + 1. + 下面是常用的获取文件路径的方式,要确保tang300.json跟当前文件在同一个文件夹下,这两种方式等价 + file_path=path.join(path.dirname(path.abspath(_file_)),'./tang300.json') + ''' + file_path=path.join(path.dirname(path.abspath(__file__)),'tang300.json') + print('当前文件路径:',__file__,'\n读取文件路径:',file_path) + ''' + 2. + 这种方式表示tang300.json在当前文件的上一级目录 + file_path=path.join(path.dirname(path.abspath(__file)),'../tang300.json') + print(__file__,file_path) + + 3. + 这种方式表示tang300.json在当前文件的上一级目录的data文件夹下 + file_path=path.join(path.dirname(path.abspath(__file__)),'../data/tang300.json') + print(__file__,file_path) + ''' + with open(file_path,'r',encoding='utf-8')as f: + return f.read() + +def merge_poems(data): + poems='' + for item in data: + poems += item.get('contents','') + return poems + +def main(): + try: + data=load_file() + logging.info(data[0]) + poems=merge_poems(json.loads(data)) + logging.info('result==>%s',stats_word.stats_text_cn(poems,100)) + except Exception as e: + logging.exception(e) + + if __name__=="__main__": + main() + \ No newline at end of file diff --git a/exercises/1901010072/d09/mymodule/stats_word.py b/exercises/1901010072/d09/mymodule/stats_word.py new file mode 100644 index 000000000..2b91b9ba0 --- /dev/null +++ b/exercises/1901010072/d09/mymodule/stats_word.py @@ -0,0 +1,32 @@ +from collections import Counter + +#统计参数中每个英文单词出现的次数 +def stats_text_en(text,count): + elements=text.split() + words=[] + symbols=',.*-!' + for elements in elements: + for symbol in symbols: + element=element.replace(symbol,'') + #用str类型的isascii方法判断是否是英文单词 + if len(element) and element.isascii(): + words.append(element) + return Counter(words).most_common(count) + + +#统计参数中每个中文汉字出现的次数 +def stats_text_cn(text, count): + cn_characters=[] + for character in text: + #unicode中中文字符的范围 + if '\u4e00'<=character<='\u9fff': + cn_characters.append(character) + return Counter(cn_characters).most_common(count) + +def stats_text(text,count): + ''' + 合并英文词频和中文词频的结果 + ''' + if not isinstance(text,str): + raise ValueError('参数必须是str类型,输入类型%s'%type(text)) + return stats_text_en(text,count)+stats_text_cn(text,count) \ No newline at end of file diff --git a/exercises/1901010072/d10/main.py.py b/exercises/1901010072/d10/main.py.py new file mode 100644 index 000000000..4cf980dcc --- /dev/null +++ b/exercises/1901010072/d10/main.py.py @@ -0,0 +1,48 @@ +from mymodule import stats_word +from os import path +import json +import re +import logging + +logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG) + +def load_file(): + ''' + 1. + 下面是常用的获取文件路径的方式,要确保tang300.json跟当前文件在同一个文件夹下,这两种方式等价 + file_path=path.join(path.dirname(path.abspath(_file_)),'./tang300.json') + ''' + file_path=path.join(path.dirname(path.abspath(__file__)),'tang300.json') + print('当前文件路径:',__file__,'\n读取文件路径:',file_path) + ''' + 2. + 这种方式表示tang300.json在当前文件的上一级目录 + file_path=path.join(path.dirname(path.abspath(__file)),'../tang300.json') + print(__file__,file_path) + + 3. + 这种方式表示tang300.json在当前文件的上一级目录的data文件夹下 + file_path=path.join(path.dirname(path.abspath(__file__)),'../data/tang300.json') + print(__file__,file_path) + ''' + with open(file_path,'r',encoding='utf-8')as f: + return f.read() + +def merge_poems(data): + poems='' + for item in data: + poems += item.get('contents','') + return poems + +def main(): + try: + data=load_file() + #logging.info(data) + poems=merge_poems(json.loads(data)) + logging.info('result==>%s',stats_word.stats_text_cn(poems,100)) + except Exception as e: + logging.exception(e) + + if __name__=="__main__": + main() + \ No newline at end of file diff --git a/exercises/1901010072/d10/mymodule/stats_word.py b/exercises/1901010072/d10/mymodule/stats_word.py new file mode 100644 index 000000000..ff47d6e16 --- /dev/null +++ b/exercises/1901010072/d10/mymodule/stats_word.py @@ -0,0 +1,32 @@ +from collections import Counter +import jieba +#pip install -i http://pypi.tuna.tsinghua.edu.cn/simple jieba +#统计参数中每个英文单词出现的次数 +def stats_text_en(text,count): + elements=text.split() + words=[] + symbols=',.*-!' + for element in elements: + for symbol in symbols: + element=element.replace(symbol,'') + #用str类型的isascii方法判断是否是英文单词 + if len(element) and element.isascii(): + words.append(element) + return Counter(words).most_common(count) + +#统计参数中每个中文汉字出现的次数 +def stats_text_cn(text,count): + words=jieba.cut(text) + tmp=[] + for i in words: + if len(i)>1: + tmp.append(i) + return Counter(tmp).most_common(count) + +def stats_text(text,count): + ''' + 合并英文词频和中文词频的结果 + ''' + if not isinstance(text,str): + raise ValueError('参数必须是str类型,输入类型%s'%type(text)) + return stats_text_cn(text,count) \ No newline at end of file diff --git a/exercises/1901010072/d11/main.py.py b/exercises/1901010072/d11/main.py.py new file mode 100644 index 000000000..3f9ce7402 --- /dev/null +++ b/exercises/1901010072/d11/main.py.py @@ -0,0 +1,37 @@ +from mymodule import stats_word +import yagmail +import requests +import pyquery +import getpass +import logging + +#安装依赖包 requests yagmail pyquery lxml +#pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests yagmail pyquery lxml + +logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG) + +#提取微信公众号文章正文 +def get_article(): + r=requests.get('https://mp.weixin.qq.com/s/hT45I5TsNv18AAfNsx81PA') + document=pyquery.PyQuery(r.text) + return document('#js_content').text() + +def main(): + try: + article=get_article() + result= stats_word.stats_text_cn(article,10) + logging.info('%s %s',type(result),str(result)) + sender=input('请输入发件人邮箱:') + #为了保护密码,输入密码的时候不会显示出来,直接输入,完成后按回车就行 + password=getpass.getpass('输入发件人邮箱密码:') + recipients=input('请输入收件人邮箱:') + #如果使用的是QQ邮箱这里就填 smtp.qq.com + yag=yagmail.SMTP(sender,password,'smtp.163.com') + yag.send(recipients,'自学训练学习2群 190101***',str(result)) + logging.info("已发送,请注意查收.") + except Exception as e: + logging.exception(e) + + if __name__=="__main__": + main() + \ No newline at end of file diff --git a/exercises/1901010072/d11/mymodule/stats_word.py b/exercises/1901010072/d11/mymodule/stats_word.py new file mode 100644 index 000000000..47ab87728 --- /dev/null +++ b/exercises/1901010072/d11/mymodule/stats_word.py @@ -0,0 +1,32 @@ +import requests +from pyquery import PyQuery +import re +import jieba +from collections import Counter +import getpass +import yagmail + +'''获取目标目标网页内容,类型是一个HTTP''' +response=requests.get("https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA") +'''提取http文件中p之间的内容''' +document = PyQuery(response.text) +content = document('p').text() + + +'''用正则去掉文本中的数字,字母和符号''' +content = re.sub('[a-zA-Z0-9’!"%&\'^\s+|\s+$()*+,-./:;,。?、…?“”‘’!]+',"",content) +'''用jieba将文本进行全模式切分''' +seg_list = jieba.cut(content, cut_all=True) +'''用counter统计词频''' +result = Counter() +for seg in seg_list: + if len(seg) > 1: + result[seg] = result[seg] + 1 +mydic = result.most_common(100) +'''返回一个对象的string格式''' +mystr = str(mydic) + +'''连接服务器,用yagmail发送邮件,此处的password为邮箱的授权码,非邮箱登录密码''' +sendSmpt = yagmail.SMTP(user = input('15001901187@163.com'), +password=getpass.getpass('mogudidizi'),host='smtp.163.com') +sendSmpt.send(to = input('pythoncamp@163.com'),subject="191010072 Bear127",contents=mystr) \ No newline at end of file diff --git a/exercises/1901010072/d12/main.py.py b/exercises/1901010072/d12/main.py.py new file mode 100644 index 000000000..01d0cf17e --- /dev/null +++ b/exercises/1901010072/d12/main.py.py @@ -0,0 +1,23 @@ +from mymodule import stats_word +from pyquery import PyQuery +from wxpy import * +import getpass +import requests + +bot = Bot() +my_friend = bot.friends() +#my_friend = bot.friends().search("丽")[0] +#my_friend.send("请发一篇公众号文章给我,我想给些惊喜你看,返回文章前10个高频词给你") +#print("消息发送成功") + +@bot.register(my_friend) +def send_result(msg): + if msg.type == "Sharing": + response = requests.get(msg.url) + document = PyQuery(response.text) + content = document('#js_content').text() + str1 = str(dict(stats_word.stats_text_cn(content,10))) + print(str1) + #my_friend.send(str1) + +embed() \ No newline at end of file diff --git a/exercises/1901010072/d12/mymodule/stats_word.py b/exercises/1901010072/d12/mymodule/stats_word.py new file mode 100644 index 000000000..47ab87728 --- /dev/null +++ b/exercises/1901010072/d12/mymodule/stats_word.py @@ -0,0 +1,32 @@ +import requests +from pyquery import PyQuery +import re +import jieba +from collections import Counter +import getpass +import yagmail + +'''获取目标目标网页内容,类型是一个HTTP''' +response=requests.get("https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA") +'''提取http文件中p之间的内容''' +document = PyQuery(response.text) +content = document('p').text() + + +'''用正则去掉文本中的数字,字母和符号''' +content = re.sub('[a-zA-Z0-9’!"%&\'^\s+|\s+$()*+,-./:;,。?、…?“”‘’!]+',"",content) +'''用jieba将文本进行全模式切分''' +seg_list = jieba.cut(content, cut_all=True) +'''用counter统计词频''' +result = Counter() +for seg in seg_list: + if len(seg) > 1: + result[seg] = result[seg] + 1 +mydic = result.most_common(100) +'''返回一个对象的string格式''' +mystr = str(mydic) + +'''连接服务器,用yagmail发送邮件,此处的password为邮箱的授权码,非邮箱登录密码''' +sendSmpt = yagmail.SMTP(user = input('15001901187@163.com'), +password=getpass.getpass('mogudidizi'),host='smtp.163.com') +sendSmpt.send(to = input('pythoncamp@163.com'),subject="191010072 Bear127",contents=mystr) \ No newline at end of file diff --git a/exercises/1901010077/README.md b/exercises/1901010077/README.md index 2ced906f5..8b1378917 100644 --- a/exercises/1901010077/README.md +++ b/exercises/1901010077/README.md @@ -1,11 +1 @@ -1 ѧһܵĹؼǷڻֻڻ㡣 -2 һܣȻǼܾҪÿϰѵӪûÿ춼ϰһδ룬ᵽ˴ӱ׾Ĺ̡ - -3 ѧաˢı飬ÿһ鶼µջƣΪʲôһοʱûз֣Ȼܶ飬ǿѲԡ - -4 ڿЦʦרͨƸ֮·ʱ֪ݷʱͼᶨҪݷĵ·ԼĿǣҪôҪôѧݷ - -5 ÿ춼ϰЦʦƷ֪źԶľ룬ڻǹؼ׹ùȥԼ̫ɵƣ˷̫౦ʱ䣬ǣãΨϰƵʣעؽδþõ㣬ȷķȷ顣 - -6 ϣѵӪܹԽԽá diff --git a/exercises/1901010077/d13/mymodule/main.py b/exercises/1901010077/d13/mymodule/main.py deleted file mode 100644 index b59a30515..000000000 --- a/exercises/1901010077/d13/mymodule/main.py +++ /dev/null @@ -1,40 +0,0 @@ -import requests -from pyquery import PyQuery -import stats_word -import matplotlib.pyplot as plt -import numpy as np -from wxpy import * - -bot = Bot() -my_friend = bot.friends().search('')[0] -my_friend.send('程序测试,请给我发送一篇文章') - -@bot.register(my_friend) -def return_msg(msg): - if msg.type == 'Sharing': - r = requests.get(msg.url) - document = PyQuery(r.text) - content = document('#js_content').text() - r_list = stats_word.stats_text(content,10) - r_dic = dict(r_list) - keys,values = zip(*r_dic.items()) - - plt.rcdefaults() - fig, ax = plt.subplots() - - people = r_list - y_pos = np.arange(len(people)) - error = np.random.rand(len(people)) - word_frequency = values - - plt.rcParams['font.sans_self']=['SimHei'] - ax.barh(y_pos, word_frequency,xerr=error,align='center',color='green',ecolor='black') - ax.set_yticks(y_pos) - ax.set_yticklabels(keys) - ax.invert_yaxis() - ax.set_xlabel('次数') - ax.set_title('文章词频统计如下') - - plt.savefig('d13.png') - msg.reply_image('d13.png') -embed() \ No newline at end of file diff --git a/exercises/1901010077/d13/mymodule/stats_word.py b/exercises/1901010077/d13/mymodule/stats_word.py deleted file mode 100644 index 31541858d..000000000 --- a/exercises/1901010077/d13/mymodule/stats_word.py +++ /dev/null @@ -1,71 +0,0 @@ -t = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -美丽胜过丑陋。 -显式优于隐式。 -简单比复杂更好。 -复杂比复杂更好。 -优于嵌套。 -稀疏优于密集。 -可读性很重要。 -特殊情况不足以打破规则。 -虽然实用性胜过纯洁。 -错误不应该默默地传递。 -除非明确沉默。 -面对困惑,拒绝猜测的诱惑。 -应该有一个 - 最好只有一个 - 明显的方法来做到这一点。 -虽然这种方式起初可能并不明显,除非你是荷兰人。 -现在比永远好。 -虽然现在永远不会比*正确好。 -如果实施很难解释,这是一个坏主意。 -如果实现很容易解释,那可能是个好主意。 -命名空间是一个很棒的主意 - 让我们做更多的事情吧! -''' -import re #引入正则表达式,以便操作字符串 -import collections #引入collections模块,以便使用计数功能 -import jieba -def stats_text_en(t,count): - if type(t) == str: - t = re.sub("[^A-Za-z]", " ", t) - t = t.lower() - t = t.split() - d = collections.Counter(t).most_common(count) - else: - raise ValueError('文本为非字符串') - -def stats_text_cn(t,count): - if type(t) == str: - t = re.sub("[^\u4e00-\u9fa5]", "", t) - t1 = jieba.cut(t) - t2 = [] - for i in t1: - if len(i) >= 2: - t2.append(i) - d = collections.Counter(t2).most_common(count) - return d - else: - raise ValueError('文本为非字符串') - -def stats_text(t,count): - if type(t) == str: - return(stats_text_en(t,count),stats_text_cn(t,count)) - else: - raise ValueError('文本为非字符串') diff --git a/exercises/1901010115/d12/main.py b/exercises/1901010115/d12/main.py deleted file mode 100644 index 2b54f8198..000000000 --- a/exercises/1901010115/d12/main.py +++ /dev/null @@ -1,25 +0,0 @@ -from mymodule import stats_word #读取模块 -import json #引入jsan解码库 -import jieba - -import requests #引入requests库用于获取网页HTML信息 - -from pyquery import PyQuery as pq #引入pyquery库解析获取的HTML信息 - -from wxpy import * #引入wxpy模块 -bot = Bot(cache_path=True) #初始化wxpy,扫码登录 -my_friend = bot.friends() #搜索好友信息 -@bot.register(my_friend,SHARING) #注册消息接收器(并限定为来自好友的,分享类信息) -def my_friend_sharing(msg): #定义函数 ,当有msg发送过来,则用requests模块获取该网址 - msg_sharing = requests.get('msg.url') #这里就是获取msg的网址信息了 - doc = pq(msg_sharing.text) #解析HTML代码 - msg_content = doc('#js_content').text() #提取文本 - msg_result = stats_word.cn(meg_content,100) #引用模块统计处理文本 - msg_result_str = str(msg_result) #返回信息处理结果 - my_friend.send(msg_result_str) #向好友发送该结果 -#以上函数没有使用return等结构我没太看懂,应该是@装饰器的使用与一般的函数不一样,得查询清楚 -embed() #堵塞线程。确保Terminal在运行完以上函数后,仍能在线接受新信息 - - - -#本次作业由于微信改版的原因,wxpy库不能正常运行,一直报错'pass ticket'。所以以上代码是未经测试的,回头阅读完装饰器内容后,找机会回来做测试。 \ No newline at end of file diff --git a/exercises/1901010115/d12/mymodule/stats_word.py b/exercises/1901010115/d12/mymodule/stats_word.py deleted file mode 100644 index b791c33be..000000000 --- a/exercises/1901010115/d12/mymodule/stats_word.py +++ /dev/null @@ -1,153 +0,0 @@ -import re -from collections import Counter -import json #测试用 -with open('tang300.json',mode='r',encoding='utf-8') as f: #测试用 - read_data = f.read() #测试用 -import jieba - - -text = ''' -愚公移⼭ -太⾏,王屋⼆⼭的北⾯,住了⼀個九⼗歲的⽼翁,名叫愚公。⼆⼭佔地廣闊,擋住去路,使他 -和家⼈往來極為不便。 -⼀天,愚公召集家⼈說:「讓我們各盡其⼒,剷平⼆⼭,開條道路,直通豫州,你們認為怎 -樣?」 -⼤家都異⼝同聲贊成,只有他的妻⼦表示懷疑,並說:「你連開鑿⼀個⼩丘的⼒量都沒有,怎 -可能剷平太⾏、王屋⼆⼭呢?況且,鑿出的⼟⽯⼜丟到哪裏去呢?」 -⼤家都熱烈地說:「把⼟⽯丟進渤海裏。」 -於是愚公就和兒孫,⼀起開挖⼟,把⼟⽯搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒⼦⼋歲也興致勃勃地⾛來幫忙。 -寒來暑往,他們要⼀年才能往返渤海⼀次。 -住在⿈河河畔的智叟,看⾒他們這樣⾟苦,取笑愚公說:「你不是很愚蠢嗎?你已⼀把年紀 -了,就是⽤盡你的氣⼒,也不能挖去⼭的⼀⻆呢?」 -愚公歎息道:「你有這樣的成⾒,是不會明⽩的。你⽐那寡婦的⼩兒⼦還不如呢!就算我死 -了,還有我的兒⼦,我的孫⼦,我的曾孫⼦,他們⼀直傳下去。⽽這⼆⼭是不會加⼤的,總有 -⼀天,我們會把它們剷平。」 -智叟聽了,無話可說: -⼆⼭的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤ -⼒神揹⾛⼆⼭。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' - -text1 = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -text2 = ''' -/“/请/!/”/“/请/!/”/两名/剑士/各自/倒转/剑尖/,/右手/握/剑柄/, -/左手/搭于/右手/手背/,/躬身行礼/。/两/人/身子/尚未/站/直/, -/突然/间/白光闪/动/,/跟着/铮的/一/声响/, -/双剑相/交/,/两/人/各/退一步/。 -/旁/观众/人/都/是/“/咦/”/的/一声/轻呼/。/青衣/剑士/连/劈/三/剑/ -''' - -text3 = ''' -二 结构化思维,几乎是最值得刻意训练的能力! -然而在现实中,很多人往往忽略结构化思维的培养,因为他们认为,这是天生的。他们要么觉得自己足够聪明所以不需要培养,要么觉得我天生不聪明,学不来,干脆放弃。 -我曾经在文章中提到过能力的重要性。有人问,能力有那么多,到底培养哪一个才好呢?如果我用一个两维矩阵来分析的话,可以看到,结构化思维能力,是既能够被培养同时价值度又高的能力。 -''' - -def stats_text_en(t,count): #定义函数,参数为t - if not isinstance(t,str): #如果t不是字符串 - raise ValueError('wrong operand type') #则报错 - else: #如果t是字符串 - t = t.lower() #文本转小写 - t = re.sub(r'[^A-Za-z]',' ',t) - t_list = t.split() #文本转列表 - x = Counter() #设定一个空计数器 - for i in t_list: #指定i遍历上述列表 - ii = i.strip(' ,.*!-') #清洗i中元素 - x[ii] += 1 #计数清洗完的单词 - return x.most_common(count)#得单词计数结果(已自动排序) - -def stats_text_cn(t,count): #定义函数,参数为t - if not isinstance(t,str): #如果t不是字符串 - raise ValueError('wrong operand type') #则报错 - else: #如果t是字符串 - t_list = [] #新建一个空列表 - exclude_str = '\n ,。!?/”“「」:\',[]' #新建一个字符串,备用(将要消除的中文符号) - y = Counter() - for char in t: #遍历文本中的字节 - t_list.append(char) #把拆解的所有字节(包括单个汉字和符号)放入新建的列表中 - for char in t_list: #遍历列表中的元素 - if '\u4e00'<=char<='\u9fff':#如果该字节为汉字,不是符号 - y[char.strip()] += 1 - return y.most_common(count) - -def stats_text(t,count): - if not isinstance(t,str): #如果t不是字符串 - raise ValueError('wrong operand type') #则报错 - else: #如果t是字符串 - stats_text_en(t,count) - stats_text_cn(t,count) - return (print(stats_text_en(t,count) + stats_text_cn(t,count))) - -def cn(t,count): - b = [i for i in t if '\u4e00' <= i <= '\u9fa5'] #去除汉字以外的i,合并为列表b - str_b = ''.join([str(i) for i in b]) #把列表b转化为无间距字符串str_b - list_b = jieba.lcut(str_b,cut_all=False) #用词库jieba分词字符串str_b后的列表,list_b - z = Counter() - for j in list_b: #j为列表list_b中一个词 - if len(j)>=2: #如果单个词的汉字数大于等于2 - z[j] +=1 #则汉字数大于等于2的词整合为一个词典,并计数排列 - return z.most_common(count) \ No newline at end of file diff --git a/exercises/1901010115/d13/main.py b/exercises/1901010115/d13/main.py deleted file mode 100644 index 2248119b5..000000000 --- a/exercises/1901010115/d13/main.py +++ /dev/null @@ -1,51 +0,0 @@ -from mymodule import stats_word #读取模块 -import json #引入jsan解码库 -import jieba - -import requests #引入requests库用于获取网页HTML信息 - -import pandas -import numpy as np -import matplotlib.pyplot as plt - -from pyquery import PyQuery as pq #引入pyquery库解析获取的HTML信息 - -from wxpy import * #引入wxpy模块 -bot = Bot(cache_path=True) #初始化wxpy,扫码登录 -my_friend = bot.friends() #搜索好友信息 -@bot.register(my_friend,SHARING) #注册消息接收器(并限定为来自好友的,分享类信息) -def my_friend_sharing(msg): #定义函数 ,当有msg发送过来,则用requests模块获取该网址 - msg_sharing = requests.get('msg.url') #这里就是获取msg的网址信息了 - doc = pq(msg_sharing.text) #解析HTML代码 - msg_content = doc('#js_content').text() #提取文本 - msg_result = stats_word.cn(msg_content,10) #引用模块统计处理文本 - - plt.rcdefaults() #固定语法,啥意思??? - fig,ax = plt.subplots() #固定语法,引入图层??? - plt.rcParams['font.sans-serif']=['SimHei'] #引入汉字输入功能 - dict_result = dict(msg_result) #字典化了那个统计结果列表,应该直接可转吧 - x_val = [] #空列表 - y_val = [] #空列表 - for keys,values in dict_result: #分别提取统计结果的键和数量值 - x_val.append(keys) - y_val.append(values) - y_pos = np.arange(len(x_val)) #y轴的范围设定为0到xv的个数??? - error = np.random.rand(len(x_val)) #啥意思??? - - ax.barh(y_pos,y_val,xerr=error,align='center') #设置一个y轴为y_pos,x轴为y_val的条形图,xerr不知控制什么,align为设定子图居于有值的视窗中间 - ax.set_yticks(y_pos) #设定y轴上的值个数,本案例为10 - ax.set_yticklabels(x_val) #y轴上各个节点的标签设定为x_val内的数据,本案例即排在前10的10个汉字 - ax.invert_yaxis() #标签由上至下读取??? - ax.set_xlabel('高频汉字') #设置y轴的标题 - ax.set_ylabel('出现次数') #设置x轴的标题 - ax.set_title('词频统计表') #设置图形的标题 - plt.savefig("词频统计图.png") #应该是把该图另存为“词频统计图。png”,这个在刚才的网搜没搜到 - - msg.reply_image("词频统计图.png") #12节wxpy模块的运用,记不太清了,见过 - -#以上函数没有使用return等结构我没太看懂,应该是@装饰器的使用与一般的函数不一样,得查询清楚 -embed() #堵塞线程。确保Terminal在运行完以上函数后,仍能在线接受新信息 - - - -#本次作业由于微信改版的原因,wxpy库不能正常运行,一直报错'pass ticket'。所以以上代码是未经测试的,回头阅读完装饰器内容后,找机会回来做测试。 \ No newline at end of file diff --git a/exercises/1901010115/d13/mymodule/stats_word.py b/exercises/1901010115/d13/mymodule/stats_word.py deleted file mode 100644 index b791c33be..000000000 --- a/exercises/1901010115/d13/mymodule/stats_word.py +++ /dev/null @@ -1,153 +0,0 @@ -import re -from collections import Counter -import json #测试用 -with open('tang300.json',mode='r',encoding='utf-8') as f: #测试用 - read_data = f.read() #测试用 -import jieba - - -text = ''' -愚公移⼭ -太⾏,王屋⼆⼭的北⾯,住了⼀個九⼗歲的⽼翁,名叫愚公。⼆⼭佔地廣闊,擋住去路,使他 -和家⼈往來極為不便。 -⼀天,愚公召集家⼈說:「讓我們各盡其⼒,剷平⼆⼭,開條道路,直通豫州,你們認為怎 -樣?」 -⼤家都異⼝同聲贊成,只有他的妻⼦表示懷疑,並說:「你連開鑿⼀個⼩丘的⼒量都沒有,怎 -可能剷平太⾏、王屋⼆⼭呢?況且,鑿出的⼟⽯⼜丟到哪裏去呢?」 -⼤家都熱烈地說:「把⼟⽯丟進渤海裏。」 -於是愚公就和兒孫,⼀起開挖⼟,把⼟⽯搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒⼦⼋歲也興致勃勃地⾛來幫忙。 -寒來暑往,他們要⼀年才能往返渤海⼀次。 -住在⿈河河畔的智叟,看⾒他們這樣⾟苦,取笑愚公說:「你不是很愚蠢嗎?你已⼀把年紀 -了,就是⽤盡你的氣⼒,也不能挖去⼭的⼀⻆呢?」 -愚公歎息道:「你有這樣的成⾒,是不會明⽩的。你⽐那寡婦的⼩兒⼦還不如呢!就算我死 -了,還有我的兒⼦,我的孫⼦,我的曾孫⼦,他們⼀直傳下去。⽽這⼆⼭是不會加⼤的,總有 -⼀天,我們會把它們剷平。」 -智叟聽了,無話可說: -⼆⼭的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤ -⼒神揹⾛⼆⼭。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' - -text1 = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -text2 = ''' -/“/请/!/”/“/请/!/”/两名/剑士/各自/倒转/剑尖/,/右手/握/剑柄/, -/左手/搭于/右手/手背/,/躬身行礼/。/两/人/身子/尚未/站/直/, -/突然/间/白光闪/动/,/跟着/铮的/一/声响/, -/双剑相/交/,/两/人/各/退一步/。 -/旁/观众/人/都/是/“/咦/”/的/一声/轻呼/。/青衣/剑士/连/劈/三/剑/ -''' - -text3 = ''' -二 结构化思维,几乎是最值得刻意训练的能力! -然而在现实中,很多人往往忽略结构化思维的培养,因为他们认为,这是天生的。他们要么觉得自己足够聪明所以不需要培养,要么觉得我天生不聪明,学不来,干脆放弃。 -我曾经在文章中提到过能力的重要性。有人问,能力有那么多,到底培养哪一个才好呢?如果我用一个两维矩阵来分析的话,可以看到,结构化思维能力,是既能够被培养同时价值度又高的能力。 -''' - -def stats_text_en(t,count): #定义函数,参数为t - if not isinstance(t,str): #如果t不是字符串 - raise ValueError('wrong operand type') #则报错 - else: #如果t是字符串 - t = t.lower() #文本转小写 - t = re.sub(r'[^A-Za-z]',' ',t) - t_list = t.split() #文本转列表 - x = Counter() #设定一个空计数器 - for i in t_list: #指定i遍历上述列表 - ii = i.strip(' ,.*!-') #清洗i中元素 - x[ii] += 1 #计数清洗完的单词 - return x.most_common(count)#得单词计数结果(已自动排序) - -def stats_text_cn(t,count): #定义函数,参数为t - if not isinstance(t,str): #如果t不是字符串 - raise ValueError('wrong operand type') #则报错 - else: #如果t是字符串 - t_list = [] #新建一个空列表 - exclude_str = '\n ,。!?/”“「」:\',[]' #新建一个字符串,备用(将要消除的中文符号) - y = Counter() - for char in t: #遍历文本中的字节 - t_list.append(char) #把拆解的所有字节(包括单个汉字和符号)放入新建的列表中 - for char in t_list: #遍历列表中的元素 - if '\u4e00'<=char<='\u9fff':#如果该字节为汉字,不是符号 - y[char.strip()] += 1 - return y.most_common(count) - -def stats_text(t,count): - if not isinstance(t,str): #如果t不是字符串 - raise ValueError('wrong operand type') #则报错 - else: #如果t是字符串 - stats_text_en(t,count) - stats_text_cn(t,count) - return (print(stats_text_en(t,count) + stats_text_cn(t,count))) - -def cn(t,count): - b = [i for i in t if '\u4e00' <= i <= '\u9fa5'] #去除汉字以外的i,合并为列表b - str_b = ''.join([str(i) for i in b]) #把列表b转化为无间距字符串str_b - list_b = jieba.lcut(str_b,cut_all=False) #用词库jieba分词字符串str_b后的列表,list_b - z = Counter() - for j in list_b: #j为列表list_b中一个词 - if len(j)>=2: #如果单个词的汉字数大于等于2 - z[j] +=1 #则汉字数大于等于2的词整合为一个词典,并计数排列 - return z.most_common(count) \ No newline at end of file diff --git a/exercises/1901010132/day10/main.py b/exercises/1901010132/day10/main.py deleted file mode 100644 index beaccbf9d..000000000 --- a/exercises/1901010132/day10/main.py +++ /dev/null @@ -1,9 +0,0 @@ -from mymodule import stats_word -import json - -with open(r'\Users\Administrator\Documents\GitHub\selfteaching-python-camp\exercises\1901010132\day10\tang300.json',encoding='UTF-8') as f: - read_date = f.read() -try: - print('统计前20的词频数: \n',stats_word.stats_text_cn(read_date,20)) -except ValueError as e: - print(e) \ No newline at end of file diff --git a/exercises/1901010132/day10/mymodule/stats_word.py b/exercises/1901010132/day10/mymodule/stats_word.py deleted file mode 100644 index 699c602ef..000000000 --- a/exercises/1901010132/day10/mymodule/stats_word.py +++ /dev/null @@ -1,50 +0,0 @@ -text= ''' -"Her eyes beginning to water, she went on, -"So I would like you all to make me a promise: -from now on, on your way to school, -or on your way home, find something beautiful -to notice. It doesn' t have to be something you -see -it could be a scent perhaps of freshly -baked bread wafting out of someone 's house, -or it could be the sound of the breeze -slightly rustling the leaves in the trees, -or the way the morning light catches one -autumn leaf as it falls gently to the ground. -Please, look for these things, and remember them." -  她的眼睛开始湿润了,她接着说因此我想让你们每个人答应我: -从今以后,在你上学或者放学的路上,要发现一些美丽的事物。 -它不一定是你看到的某个东西——它可能是一种香味—— -也许是新鲜烤面包的味道从某一座房里飘出来,也许是微风轻拂树叶的声音, -或者是晨光照射在轻轻飘落的秋叶上的方式。请你们寻找这些东西并且记住它们吧。 -''' -import re -import collections -import jieba #结巴中文分词 -count=int() -def stats_text_en(text,count): - if type(text) == str: - b=re.sub(r'[^A-Za-z]',' ',text) - list1=b.split() - return(collections.Counter(list1).most_common(count)) - else: - raise ValueError('文本为非字符串') - -def stats_text_cn(text,count): - if not isinstance(text,str): - raise ValueError('文本为非字符串') - p=re.compile(u'[\u4e00-\u9fa5]') - a=re.findall(p,text) - str2=''.join(a) - seg_list = jieba.cut(str2,cut_all=False) #jieba.cut返回的结构是一个可迭代的生成器generator - newlist=[] - for i in seg_list: - if len(i) >= 2: - newlist.append(i) - return(collections.Counter(newlist).most_common(count)) - -def stats_text(text,count): - if not isinstance(text,str): - raise ValueError('文本为非字符串') - stats_text_cn(text,count) - stats_text_en(text,count) -stats_text(text,count) diff --git a/exercises/1901010132/day11/main.py b/exercises/1901010132/day11/main.py deleted file mode 100644 index c8112f33c..000000000 --- a/exercises/1901010132/day11/main.py +++ /dev/null @@ -1,27 +0,0 @@ -import requests -import pyquery -from pyquery import PyQuery -from mymodule import stats_word -import getpass -import yagmail -# 抓取网页 -r = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - -# 提取正文 -document = PyQuery(r.text) -content = document('#js_content').text() -print(content) - -#词频统计并转为str类型 -#wordString = ''.join(str(i) for i in wordList) -word_list = stats_word.stats_text_cn(content,100) -word_str = str(word_list) #转换成str类型 -print(word_str) - -#发送统计结果到指定邮箱 -sender = input('请输入发件人邮箱:') -psw = getpass.getpass() #授权码 -recipients = input('输入收件人邮箱:') #指定邮箱pythoncamp@163.com -smtp = "smtp.qq.com" #服务器地址 - -yagmail.SMTP(sender,psw,smtp).send(recipients,'【1901010132】自学训练营学习2群DAY11 bamboo',word_str) \ No newline at end of file diff --git a/exercises/1901010132/day11/mymodule/stats_word.py b/exercises/1901010132/day11/mymodule/stats_word.py deleted file mode 100644 index 699c602ef..000000000 --- a/exercises/1901010132/day11/mymodule/stats_word.py +++ /dev/null @@ -1,50 +0,0 @@ -text= ''' -"Her eyes beginning to water, she went on, -"So I would like you all to make me a promise: -from now on, on your way to school, -or on your way home, find something beautiful -to notice. It doesn' t have to be something you -see -it could be a scent perhaps of freshly -baked bread wafting out of someone 's house, -or it could be the sound of the breeze -slightly rustling the leaves in the trees, -or the way the morning light catches one -autumn leaf as it falls gently to the ground. -Please, look for these things, and remember them." -  她的眼睛开始湿润了,她接着说因此我想让你们每个人答应我: -从今以后,在你上学或者放学的路上,要发现一些美丽的事物。 -它不一定是你看到的某个东西——它可能是一种香味—— -也许是新鲜烤面包的味道从某一座房里飘出来,也许是微风轻拂树叶的声音, -或者是晨光照射在轻轻飘落的秋叶上的方式。请你们寻找这些东西并且记住它们吧。 -''' -import re -import collections -import jieba #结巴中文分词 -count=int() -def stats_text_en(text,count): - if type(text) == str: - b=re.sub(r'[^A-Za-z]',' ',text) - list1=b.split() - return(collections.Counter(list1).most_common(count)) - else: - raise ValueError('文本为非字符串') - -def stats_text_cn(text,count): - if not isinstance(text,str): - raise ValueError('文本为非字符串') - p=re.compile(u'[\u4e00-\u9fa5]') - a=re.findall(p,text) - str2=''.join(a) - seg_list = jieba.cut(str2,cut_all=False) #jieba.cut返回的结构是一个可迭代的生成器generator - newlist=[] - for i in seg_list: - if len(i) >= 2: - newlist.append(i) - return(collections.Counter(newlist).most_common(count)) - -def stats_text(text,count): - if not isinstance(text,str): - raise ValueError('文本为非字符串') - stats_text_cn(text,count) - stats_text_en(text,count) -stats_text(text,count) diff --git a/exercises/1901010132/day12/main.py b/exercises/1901010132/day12/main.py deleted file mode 100644 index 692dbac6d..000000000 --- a/exercises/1901010132/day12/main.py +++ /dev/null @@ -1,21 +0,0 @@ -import requests -from pyquery import PyQuery -from mymodule import stats_word -from wxpy import Bot,Message,embed -#初始化机器人,扫码登陆 -bot = Bot() -#找到好友 -my_friend = bot.friends().search('PrincessAKing')[0] -#发送文本给好友 -my_friend.send('分享任意微信文章给我') -#监听消息 -#回复my_friend的消息 -@bot.register(my_friend) -def reply_my_friend(msg): - if msg.type == 'Sharing': - response = requests.get(msg.url) - document = PyQuery(response.text) - content = document('#js_content').text() - reply = stats_word.stats_text_cn(content,100) - return reply -embed() diff --git a/exercises/1901010132/day12/mymodule/stats_word.py b/exercises/1901010132/day12/mymodule/stats_word.py deleted file mode 100644 index 699c602ef..000000000 --- a/exercises/1901010132/day12/mymodule/stats_word.py +++ /dev/null @@ -1,50 +0,0 @@ -text= ''' -"Her eyes beginning to water, she went on, -"So I would like you all to make me a promise: -from now on, on your way to school, -or on your way home, find something beautiful -to notice. It doesn' t have to be something you -see -it could be a scent perhaps of freshly -baked bread wafting out of someone 's house, -or it could be the sound of the breeze -slightly rustling the leaves in the trees, -or the way the morning light catches one -autumn leaf as it falls gently to the ground. -Please, look for these things, and remember them." -  她的眼睛开始湿润了,她接着说因此我想让你们每个人答应我: -从今以后,在你上学或者放学的路上,要发现一些美丽的事物。 -它不一定是你看到的某个东西——它可能是一种香味—— -也许是新鲜烤面包的味道从某一座房里飘出来,也许是微风轻拂树叶的声音, -或者是晨光照射在轻轻飘落的秋叶上的方式。请你们寻找这些东西并且记住它们吧。 -''' -import re -import collections -import jieba #结巴中文分词 -count=int() -def stats_text_en(text,count): - if type(text) == str: - b=re.sub(r'[^A-Za-z]',' ',text) - list1=b.split() - return(collections.Counter(list1).most_common(count)) - else: - raise ValueError('文本为非字符串') - -def stats_text_cn(text,count): - if not isinstance(text,str): - raise ValueError('文本为非字符串') - p=re.compile(u'[\u4e00-\u9fa5]') - a=re.findall(p,text) - str2=''.join(a) - seg_list = jieba.cut(str2,cut_all=False) #jieba.cut返回的结构是一个可迭代的生成器generator - newlist=[] - for i in seg_list: - if len(i) >= 2: - newlist.append(i) - return(collections.Counter(newlist).most_common(count)) - -def stats_text(text,count): - if not isinstance(text,str): - raise ValueError('文本为非字符串') - stats_text_cn(text,count) - stats_text_en(text,count) -stats_text(text,count) diff --git a/exercises/1901010132/day9/main.py b/exercises/1901010132/day9/main.py deleted file mode 100644 index e2040b402..000000000 --- a/exercises/1901010132/day9/main.py +++ /dev/null @@ -1,8 +0,0 @@ -from mymodule import stats_word -import json - -with open(r'\Users\Administrator\Documents\GitHub\selfteaching-python-camp\exercises\1901010132\day9\tang300.json',encoding='UTF-8') as f: - text=f.read() - - -stats_word.stats_text_cn(text, 100) \ No newline at end of file diff --git a/exercises/1901010132/day9/mymodule/stats_word.py b/exercises/1901010132/day9/mymodule/stats_word.py deleted file mode 100644 index 7a3c0ab41..000000000 --- a/exercises/1901010132/day9/mymodule/stats_word.py +++ /dev/null @@ -1,42 +0,0 @@ -text= ''' -"Her eyes beginning to water, she went on, -"So I would like you all to make me a promise: -from now on, on your way to school, -or on your way home, find something beautiful -to notice. It doesn' t have to be something you -see -it could be a scent perhaps of freshly -baked bread wafting out of someone 's house, -or it could be the sound of the breeze -slightly rustling the leaves in the trees, -or the way the morning light catches one -autumn leaf as it falls gently to the ground. -Please, look for these things, and remember them." -  她的眼睛开始湿润了,她接着说因此我想让你们每个人答应我: -从今以后,在你上学或者放学的路上,要发现一些美丽的事物。 -它不一定是你看到的某个东西——它可能是一种香味—— -也许是新鲜烤面包的味道从某一座房里飘出来,也许是微风轻拂树叶的声音, -或者是晨光照射在轻轻飘落的秋叶上的方式。请你们寻找这些东西并且记住它们吧。 -''' -import re -import collections -count=int() -def stats_text_en(text,count): - if type(text)!=str: - raise ValueError("文本为非字符串") - text=re.sub('[^a-zA-Z]','',text.strip()) #表示所有非英文字母 - text=text.split() - print(collections.Counter(text).most_common(count)) - -def stats_text_cn(text,count): #定义检索中文函数 - if type(text)!=str: - raise ValueError("文本为非字符串") - text=re.sub('[^\u4e00-\u9fa5]','',text) #[^\u4e00-\u9fa5]表示所有非中文 - text=' '.join(text) - text=text.split() - print(collections.Counter(text).most_common(count)) - -def stats_word(text,count): #定义函数,实现统计汉字和英文单词出现次数 - if type(text)!=str: - raise ValueError("文本为非字符串") - stats_text_en(text,count) - stats_text_cn(text,count) diff --git a/exercises/1901010171/1001S02E01_helloworld.txt.txt b/exercises/1901010171/1001S02E01_helloworld.txt.txt deleted file mode 100644 index 19c0c3968..000000000 --- a/exercises/1901010171/1001S02E01_helloworld.txt.txt +++ /dev/null @@ -1 +0,0 @@ -day1ɣ \ No newline at end of file diff --git a/exercises/1901010171/1001S02E02_hello_python.py.txt b/exercises/1901010171/1001S02E02_hello_python.py.txt deleted file mode 100644 index ec6fc4648..000000000 --- a/exercises/1901010171/1001S02E02_hello_python.py.txt +++ /dev/null @@ -1 +0,0 @@ -print `Hello World` \ No newline at end of file diff --git a/exercises/1901010171/README.md.txt b/exercises/1901010171/README.md.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/exercises/1901040001/README.md b/exercises/1901040001/README.md index b94cdd680..8b1378917 100644 --- a/exercises/1901040001/README.md +++ b/exercises/1901040001/README.md @@ -1,17 +1 @@ -## 自学总结 - -#### 反思 - -- 在学习的过程中,**“拖延“**始终萦绕我左右,终究来讲,还是不够自律。**要多找事做**,不要碌碌无为,充实的生活才是有意义的生活。 -- 在学习过程中,有好多不懂的地方,都参考了别人的代码,要渐渐养成有**独立思考**,每一次都要真真切切的深入思考。 -- 在学习过程中,遇到问题,也没有去询问谷歌,究其原因,还是对英语的害怕,也逐渐克服这个心理。 -- **自学不是一个人的战斗**,要有有效的社交,跟着编程大牛一起学习。 - -#### 期望 - -- 我个人对**数据挖掘与数据分析**比较感兴趣,所以以后会朝着这个方向努力。 -- 其次,李笑来老师在《自学是门手艺》中提到了***think python***这本书,虽然现在自学营结束,但是学习编程不能结束,还是继续学习。 -- 另外,《自学是门手艺》这个官方文档的地图指南,要充分利用好,反复学习。 -- 对于《 MIT OCW 6.0001 课程》也要进行充分学习。 -- 自学营结课了,但是还有好多需要学习的,不能停下脚步。我用来学习编程的时间预算很长,**一生**,我还就不信了,我就一直学不会? diff --git a/exercises/1901040001/d10/main.py b/exercises/1901040001/d10/main.py deleted file mode 100644 index b33fc3437..000000000 --- a/exercises/1901040001/d10/main.py +++ /dev/null @@ -1,11 +0,0 @@ -#从mymodule文件夹中调用stats_word.py -from mymodule import stats_word -import json -if __name__ == "__main__": - with open(r'C:\Users\xiacongcong\Documents\GitHub\selfteaching-python-camp\exercises\1901040001\d10\tang300.json', 'rb') as f: - text = f.read() - text = text.decode(encoding='utf-8') - try: - stats_word.stats_text_cn(text) - except ValueError: - print('The input is a non-string, please enter a string.') diff --git a/exercises/1901040001/d10/mymodule/stats_word.py b/exercises/1901040001/d10/mymodule/stats_word.py deleted file mode 100644 index 0c12e12fb..000000000 --- a/exercises/1901040001/d10/mymodule/stats_word.py +++ /dev/null @@ -1,22 +0,0 @@ -import collections -import re -import jieba - -#将中文进行词频统计。 -def stats_text_cn(text): - if type(text) == str: - count = 20 #设定输出个数 - list1 = re.findall(r'[\u4e00-\u9fa5]', text) #筛选出文本中所有的中文字符 - string1 = "".join(list1) #将列表转化成字符串 - list2 = jieba.lcut(string1) #使用结巴对字符串进行分词 - #将分词的结果进行处理,去除长度为1的中文词汇 - list3 = list2[:] - for i in list2: - if len(i) == 1: - list3.remove(i) - list2 = list3 - #将处理过的分词结果进行排序 - word_frequencycount_cn = collections.Counter(list2).most_common(count) - return print(word_frequencycount_cn) - else: - raise ValueError("The input is a non-string, please enter a string.") \ No newline at end of file diff --git a/exercises/1901040001/d11/main.py b/exercises/1901040001/d11/main.py deleted file mode 100644 index a9f645263..000000000 --- a/exercises/1901040001/d11/main.py +++ /dev/null @@ -1,22 +0,0 @@ -# 从mymodule文件夹中调用stats_word.py -from mymodule import stats_word -from pyquery import PyQuery -import requests -import getpass -import yagmail - -if __name__ == "__main__": - # 获取requests对象 - rsp = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - # 提取微信公众号正文伪代码 - document = PyQuery(rsp.text) - text = document('#js_content').text() - try: - content = stats_word.stats_text_cn(text) - user = input('Please enter the sender\'s email address:') - password = getpass.getpass('Please enter the sender\'s email password:') - recipient = input('Please enter the recipient\'s email address:') - yag = yagmail.SMTP(user,password,'smtp.qq.com',smtp_ssl=True) - yag.send(recipient,'【1901040001】自学训练营3群 DAY11 XiaCongcong',content) - except ValueError: - print('The input is a non-string, please enter a string.') \ No newline at end of file diff --git a/exercises/1901040001/d11/mymodule/stats_word.py b/exercises/1901040001/d11/mymodule/stats_word.py deleted file mode 100644 index f44795aee..000000000 --- a/exercises/1901040001/d11/mymodule/stats_word.py +++ /dev/null @@ -1,23 +0,0 @@ -import collections -import re -import jieba - - -# 将中文进行词频统计。 -def stats_text_cn(text): - if type(text) == str: - count = 100 # 设定输出个数 - list1 = re.findall(r'[\u4e00-\u9fa5]', text) # 筛选出文本中所有的中文字符 - string1 = "".join(list1) # 将列表转化成字符串 - list2 = jieba.lcut(string1) # 使用结巴对字符串进行分词 - # 将分词的结果进行处理,去除长度为1的中文词汇 - list3 = list2[:] - for i in list2: - if len(i) == 1: - list3.remove(i) - list2 = list3 - word_frequencycount_cn_list = collections.Counter(list2).most_common(count) # 将处理过的分词结果进行排序 - word_frequencycount_cn_str = str(word_frequencycount_cn_list) # 将结果转化为字符串 - return word_frequencycount_cn_str - else: - raise ValueError("The input is a non-string, please enter a string.") \ No newline at end of file diff --git a/exercises/1901040001/d12/main.py b/exercises/1901040001/d12/main.py deleted file mode 100644 index 15ccbb122..000000000 --- a/exercises/1901040001/d12/main.py +++ /dev/null @@ -1,22 +0,0 @@ -# 从mymodule文件夹中调用stats_word.py -from mymodule import stats_word -from pyquery import PyQuery -from wxpy import * -import requests - -if __name__ == "__main__": - try: - bot = Bot() - my_friend = bot.friend().search('夏聪聪',sex=MALE,city='')[0] - my_friend.send('这是一个程序测试,请给我发一篇公众号文章。') - - @bot.register() - def print_other(msg): - if msg.type == 'sharing': - r = requests.get(msg.url) - document = PyQuery(r.text) - text = document('#js_content').text() - content = stats_word.stats_text_cn(text,100) - msg.reply(content) - except ValueError: - print('The input is a non-string, please enter a string.') \ No newline at end of file diff --git a/exercises/1901040001/d12/mymodule/stats_word.py b/exercises/1901040001/d12/mymodule/stats_word.py deleted file mode 100644 index bd22965e6..000000000 --- a/exercises/1901040001/d12/mymodule/stats_word.py +++ /dev/null @@ -1,27 +0,0 @@ -import collections -import re -import jieba - - -# 将中文进行词频统计。 -def stats_text_cn(text,count): - if type(text) == str: - # 筛选出文本中所有的中文字符 - list1 = re.findall(r'[\u4e00-\u9fa5]', text) - # 将列表转化成字符串 - string1 = "".join(list1) - # 使用结巴对字符串进行分词 - list2 = jieba.lcut(string1) - # 将分词的结果进行处理,去除长度为1的中文词汇 - list3 = list2[:] - for i in list2: - if len(i) == 1: - list3.remove(i) - list2 = list3 - # 将处理过的分词结果进行排序 - word_frequencycount_cn_list = collections.Counter(list2).most_common(count) - # 将结果转化为字符串 - word_frequencycount_cn_str = str(word_frequencycount_cn_list) - return word_frequencycount_cn_str - else: - raise ValueError("The input is a non-string, please enter a string.") \ No newline at end of file diff --git a/exercises/1901040001/d13/main.py b/exercises/1901040001/d13/main.py deleted file mode 100644 index 532f4a3a9..000000000 --- a/exercises/1901040001/d13/main.py +++ /dev/null @@ -1,40 +0,0 @@ -from mymodule import stats_word -from pyquery import PyQuery -from wxpy import * -import requests -import matplotlib.pyplot as plt -import numpy as np - -bot = Bot() -my_friend = bot.friend().search('夏聪聪',sex=MALE,city='')[0] -my_friend.send('这是一个程序测试,请给我发一篇公众号文章。') - -@bot.register(my_friend) -def print_others(msg): - if msg.type == 'sharing': - r = requests.get(msg.url) - document = PyQuery(r.text) - text = document('#js_content').text() - content_list = stats_word.stats_text_cn(text,10) - content_dict = dict(content_list) - keys,values = zip(*content_dict.items()) - - plt.rcdefaults() - fig, ax = plt.subplots() - - people = content_list - y_pos = np.arange(len(people)) - error = np.random.rand(len(people)) - word_frequency = values - - plt.rcParams["font.sans_self"] = ["SimHei"] - ax.barh(y_pos, word_frequency,xerr=error,align="center",color="green",ecolor="black") - ax.set_yticks(y_pos) - ax.set_yticklabels(keys) - ax.invert_yaxis() - ax.set_xlabel("次数") - ax.sex_title("文章词频统计如下") - - plt.savefig("d13.png") - msg.reply_image("d13.png") -embed() \ No newline at end of file diff --git a/exercises/1901040001/d13/mymodule/stats_word.py b/exercises/1901040001/d13/mymodule/stats_word.py deleted file mode 100644 index 8e3e9b4fc..000000000 --- a/exercises/1901040001/d13/mymodule/stats_word.py +++ /dev/null @@ -1,25 +0,0 @@ -import collections -import re -import jieba - - -# 对中文字符进行词频统计。 -def stats_text_cn(text,count): - if type(text) == str: - # 筛选出文本中所有的中文字符 - list1 = re.findall(r'[\u4e00-\u9fa5]', text) - # 将列表list1转化成字符串string1 - string1 = "".join(list1) - # 使用结巴对字符串进行分词 - list2 = jieba.lcut(string1) - # 将分词的结果进行处理,去除长度为1的中文词汇 - list3 = list2[:] - for i in list2: - if len(i) == 1: - list3.remove(i) - list2 = list3 - # 将处理过的分词结果进行排序,返回一个列表类型 - word_frequency_count_cn_list = collections.Counter(list2).most_common(count) - return word_frequency_count_cn_list - else: - raise ValueError("The input is a non-string, please enter a string.") \ No newline at end of file diff --git a/exercises/1901050073/1001S02E03_calculator.py b/exercises/1901050073/1001S02E03_calculator.py deleted file mode 100644 index c79a92423..000000000 --- a/exercises/1901050073/1001S02E03_calculator.py +++ /dev/null @@ -1,41 +0,0 @@ -# 定义函数 -def add(x,y): - """加""" - return x + y - -def subtract(x,y): - """减""" - return x - y - -def multiply(x,y): - """乘""" - return x * y - -def divide(x,y): - """除""" - return x / y - -# 用户输入 -print("选择运算:") -print("1.加") -print("2.减") -print("3.乘") -print("4.除") - -choice = input("choice(1/2/3/4):") -num1 = int(input("num1:")) -num2 = int(input("num2:")) - -if choice == '1': - print(num1,"+",num2,"=",add(num1,num2)) - -elif choice == '2': - print(num1,"-",num2,"=",subtract(num1,num2)) - -elif choice == '3': - print(num1,"*",num2,"=",multiply(num1,num2)) - -elif choice == '4': - print(num1,"/",num2,"=",divide(num1,num2)) -else: - print('输入错误') diff --git a/exercises/1901050073/workspace/day.py b/exercises/1901050073/workspace/day.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/exercises/1901050077/1001S02E03_calculator.py b/exercises/1901050077/1001S02E03_calculator.py deleted file mode 100644 index 7f3665817..000000000 --- a/exercises/1901050077/1001S02E03_calculator.py +++ /dev/null @@ -1,28 +0,0 @@ -# 计算器确定三个输入值,分别是运算符、运算符左边的数字和右边的数字 - -# 把内置函数input接收的输入字符赋值给变量 -operator=input('请输入运算符(+、-、*、/):')#input里面的字符串的作用是在等待输入的时候进行提示 -first_number=input('请输入第一个数字:') -second_number=input('请输入第二个数字:') - -a=int(first_number) #int(first_number)在这里的作用是把str类型的first number转换为int类型 -b=int(second_number) - -print('operator:',operator,type(operator)) -print('first_number:',first_number,type(first_number),type(a)) -print('second_number:',second_number,type(second_number),type(b)) - -print('测试加法str加法:',first_number+second_number) -#print(测试加法str减法:',first_number-second_number) - -if operator=='+': - print(a,'+',b,'=',a+b) -elif operator=='-': - print(a,'-',b,'=',a-b) -elif operator=='*': - print(a,'*',b,'=',a*b) -elif operator=='/': - print(a,'/',b,'=',a/b) -else: - print('无效的运算符') - #raise ValueError('无效的运算符') \ No newline at end of file diff --git a/exercises/1901050077/1001S02E04_control_flow-1.py b/exercises/1901050077/1001S02E04_control_flow-1.py deleted file mode 100644 index d5b0aa62a..000000000 --- a/exercises/1901050077/1001S02E04_control_flow-1.py +++ /dev/null @@ -1,5 +0,0 @@ -# 输出99乘法表 -for m in range(1,10): - for n in range(1,m+1): - print('{}*{}={}\t'.format(m,n,m*n),end='') - print() \ No newline at end of file diff --git a/exercises/1901050077/1001S02E04_control_flow-2.py b/exercises/1901050077/1001S02E04_control_flow-2.py deleted file mode 100644 index 92b4f1884..000000000 --- a/exercises/1901050077/1001S02E04_control_flow-2.py +++ /dev/null @@ -1,13 +0,0 @@ -# 输出奇数行的99乘法表 -m=-1 -n=0 -while m<9: - m%2!=0 - m+=2 - while n<9: - n+=1 - print(m,'*',n,'=',m*n,end='') - if m==n: - n=0 - print() - break diff --git a/exercises/1901050190/d08/main.py b/exercises/1901050190/d08/main.py deleted file mode 100644 index 9c42f20fb..000000000 --- a/exercises/1901050190/d08/main.py +++ /dev/null @@ -1,83 +0,0 @@ -from mymodule import stats_word - -import traceback -import logging - -logger = logging.getLogger(__name__) - - -def text_traceback(): - try: - stats_word.stats_text(1) - except Exception as e: - print('text_traceback =>', e) - print(traceback.format_exc()) - -def text_logger(): - try: - stats_word.stats_text(1) - except Exception as e: - print('text_logger =>', e) - logger.Exception(e) - - -if __name__ == "__main__": - stats_word.stats_text(1) - text_traceback() - text_logger() - -text = ''' - -愚公移山 -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,檔住去路,使他 和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎 樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鏊一個小丘的力量都沒有,怎 可能剷平太行、王屋二山昵?況且,鏊出的土石又丟到哪裏去昵?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀 了,就是用盡你的氣力,也不能挖去山的一角昵?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如昵!就算我死 了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有 一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大 力神揹走二山。 - -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads to -Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered his -wife. “How on earth do you suppose you can level Mount Taixin and -Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea of -Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected for -his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong and -his crew were, they were struck with fear and reported the incident -to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered two -mighty gods to carry the mountains away. -''' \ No newline at end of file diff --git a/exercises/1901050190/d08/mymodule/stats_word.py b/exercises/1901050190/d08/mymodule/stats_word.py deleted file mode 100644 index cb39310bb..000000000 --- a/exercises/1901050190/d08/mymodule/stats_word.py +++ /dev/null @@ -1,99 +0,0 @@ -en_text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -cn_text = ''' -美丽总比丑陋好。 -显式比隐式好。 -简单总比复杂好。 -复杂总比复杂好。 -平的比嵌套的好。 -稀疏总比密集好。 -可读性。 -特殊情况还不足以打破规则。 -虽然实用性胜过纯洁性。 -错误不应该悄无声息地过去。 -除非显式地沉默。 -面对敏锐,拒绝猜测的诱惑。 -应该有一种——最好只有一种——显而易见的方法 -它。 -不过,除非你是荷兰人,否则这种方式一开始可能并不明显。 -现在总比不做好。 -虽然从来没有比“现在”更好。 -如果实现很难解释,这是一个坏主意。 -如果实现很容易解释,这可能是一个好主意。 -名称空间是一个很棒的主意——让我们做更多这样的事情! -''' -def stats_text_en(text): - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - elements = en_text.split() -# print(elements) - words = [] - symbols = ',.-!*' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - if len (element): - words. append(element) - counter = {} - word_set = set(words) - for word in word_set: - counter[word] = words. count(word) - - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - - -def stats_text_cn(text): - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - cn_characters = [] - for character in text: - if '\u4c00' <= character <= '\u9ffff': - cn_characters.append(character) - counter = {} - cn_character_set = set(cn_characters) - for character in cn_character_set: - counter[character] = cn_characters.count(character) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - - -if __name__ == "__main__": - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) -# print('统计参数每个英文单词出现的次数 ==>\n', en_result) -# print('统计参数每个中文单词出现的次数 ==>\n', cn_result) - -def stats_text(text): - - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - - return stats_text_en(text) + stats_text_cn(text) - -if __name__ == "__main__": - en_cn_result = stats_text_en(en_text) + stats_text_cn(cn_text) - - print('统计参数每个中、英文单词出现的次数 ==>\n', en_cn_result) - diff --git a/exercises/1901050190/d09/main.py b/exercises/1901050190/d09/main.py deleted file mode 100644 index 9c450c358..000000000 --- a/exercises/1901050190/d09/main.py +++ /dev/null @@ -1,36 +0,0 @@ -from mymodule import stats_word -from os import path -import json -import re -import logging - -logging.basicConfig( - format='file:%(filename)s|line:%(lineno)d|message: %(message)s', level=logging.DEBUG) - -def load_file(): - - file_path = path.join(path.dirname(path.abspath(__file__)), 'tang300.json') - print('当前文件路径:', __file__, '\n读取文件路径:', file_path) - - with open(file_path, 'r', encoding='utf-8') as f: - return f.read() - - -def merge_poems(data): - poems = '' - for item in data: - poems += item.get('contents', '') - return poems - -def main(): # - try: - data = load_file() - logging.info(data[0]) #打印检查代码 - poems = merge_poems(json.loads(data)) #转化josn格式 - logging.info('reasult ==> %s', stats_word.stats_text_cn(poems, 100)) - except Exception as e: - logging.exception(e) #捕获异常 - - -if __name__ == "__main__": - main() diff --git a/exercises/1901050190/d09/mymodule/stats_word.py b/exercises/1901050190/d09/mymodule/stats_word.py deleted file mode 100644 index c6604d789..000000000 --- a/exercises/1901050190/d09/mymodule/stats_word.py +++ /dev/null @@ -1,93 +0,0 @@ -from collections import Counter -# import re - -def stats_text_en(text, Count): #统计英文单词出现次数 - - if not isinstance(text, str): #如果不是字符串,抛出异常 - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - - elements = en_text.split() -# print(elements) - words = [] - symbols = ',.-!*' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - if len (element): - words. append(element) - - return Counter(words).most_common(Count) - - -def stats_text_cn(text, Count): #统计中文字出现次数 - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - cn_characters = [] - for character in text: - if '\u4c00' <= character <= '\u9ffff': - cn_characters.append(character) - - return Counter(cn_characters).most_common(Count) - - -def stats_text(text, Count): #统计中、英文词出现次数 - - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - - return stats_text_en(text, Count) + stats_text_cn(text, Count) - - -# if __name__ == "__main__": -# en_result = stats_text_en(en_text) -# print('统计参数每个英文单词出现的次数 ==>\n', en_result) -# cn_result = stats_text_cn(cn_text) -# print('统计参数每个中文单词出现的次数 ==>\n', cn_result) -# en_cn_result = stats_text_en(en_text) + stats_text_cn(cn_text) -# print('统计参数每个中、英文单词出现的次数 ==>\n', en_cn_result) - -en_text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -cn_text = ''' -美丽总比丑陋好。 -显式比隐式好。 -简单总比复杂好。 -复杂总比复杂好。 -平的比嵌套的好。 -稀疏总比密集好。 -可读性。 -特殊情况还不足以打破规则。 -虽然实用性胜过纯洁性。 -错误不应该悄无声息地过去。 -除非显式地沉默。 -面对敏锐,拒绝猜测的诱惑。 -应该有一种——最好只有一种——显而易见的方法 -它。 -不过,除非你是荷兰人,否则这种方式一开始可能并不明显。 -现在总比不做好。 -虽然从来没有比“现在”更好。 -如果实现很难解释,这是一个坏主意。 -如果实现很容易解释,这可能是一个好主意。 -名称空间是一个很棒的主意——让我们做更多这样的事情! -''' \ No newline at end of file diff --git a/exercises/1901050190/d09/tang300.json b/exercises/1901050190/d09/tang300.json deleted file mode 100644 index 3d22e82ae..000000000 --- a/exercises/1901050190/d09/tang300.json +++ /dev/null @@ -1,2235 +0,0 @@ -[ - { - "id": 1, - "contents": "孤鸿海上来,池潢不敢顾。\n侧见双翠鸟,巢在三珠树。\n矫矫珍木巅,得无金丸惧。\n美服患人指,高明逼神恶。\n今我游冥冥,弋者何所慕。", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之一" - }, - { - "id": 2, - "contents": "兰叶春葳蕤,桂华秋皎洁。\n欣欣此生意,自尔为佳节。\n谁知林栖者,闻风坐相悦。\n草木有本心,何求美人折?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之二" - }, - { - "id": 3, - "contents": "幽人归独卧,滞虑洗孤清。\n持此谢高鸟,因之传远情。\n日夕怀空意,人谁感至精?\n飞沈理自隔,何所慰吾诚?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之三" - }, - { - "id": 4, - "contents": "江南有丹橘,经冬犹绿林。\n岂伊地气暖,自有岁寒心。\n可以荐嘉客,奈何阻重深!\n运命惟所遇,循环不可寻。\n徒言树桃李,此木岂无阴?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之四" - }, - { - "id": 5, - "contents": "暮从碧山下,山月随人归,\n却顾所来径,苍苍横翠微。\n相携及田家,童稚开荆扉。\n绿竹入幽径,青萝拂行衣。\n欢言得所憩,美酒聊共挥。\n长歌吟松风,曲尽河星稀。\n我醉君复乐,陶然共忘机。", - "type": "五言古诗", - "author": "李白", - "title": "下终南山过斛斯山人宿置酒" - }, - { - "id": 6, - "contents": "花间一壶酒,独酌无相亲。\n举杯邀明月,对影成三人。\n月既不解饮,影徒随我身。\n暂伴月将影,行乐须及春。\n我歌月徘徊,我舞影零乱。\n醒时同交欢,醉后各分散。\n永结无情游,相期邈云汉。", - "type": "五言古诗", - "author": "李白", - "title": "月下独酌" - }, - { - "id": 7, - "contents": "燕草如碧丝,秦桑低绿枝。\n当君怀归日,是妾断肠时。\n春风不相识,何事入罗帏?", - "type": "五言古诗", - "author": "李白", - "title": "春思" - }, - { - "id": 8, - "contents": "岱宗夫如何,齐鲁青未了。\n造化钟神秀,阴阳割昏晓。\n荡胸生层云,决眦入归鸟,\n会当凌绝顶,一览众山小。", - "type": "五言古诗", - "author": "杜甫", - "title": "望岳" - }, - { - "id": 9, - "contents": "人生不相见,动如参与商。\n今夕复何夕,共此灯烛光。\n少壮能几时,鬓发各已苍。\n访旧半为鬼,惊呼热中肠。\n焉知二十载,重上君子堂。\n昔别君未婚,儿女忽成行。\n怡然敬父执,问我来何方。\n问答乃未已,驱儿罗酒浆。\n夜雨剪春韭,新炊间黄粱。\n主称会面难,一举累十觞。\n十觞亦不醉,感子故意长。\n明日隔山岳,世事两茫茫。", - "type": "五言古诗", - "author": "杜甫", - "title": "赠卫八处士" - }, - { - "id": 10, - "contents": "绝代有佳人,幽居在空谷。\n自云良家子,零落依草木。\n关中昔丧乱,兄弟遭杀戮。\n官高何足论,不得收骨肉。\n世情恶衰歇,万事随转烛。\n夫婿轻薄儿,新人美如玉。\n合昏尚知时,鸳鸯不独宿。\n但见新人笑,那闻旧人哭!\n在山泉水清,出山泉水浊。\n侍婢卖珠回,牵萝补茅屋。\n摘花不插发,采柏动盈掬。\n天寒翠袖薄,日暮倚修竹。", - "type": "五言古诗", - "author": "杜甫", - "title": "佳人" - }, - { - "id": 11, - "contents": "死别已吞声,生别常恻恻。\n江南瘴疠地,逐客无消息。\n故人入我梦,明我长相忆。\n君今在罗网,何以有羽翼?\n恐非平生魂,路远不可测。\n魂来枫林青,魂返关塞黑。\n落月满屋梁,犹疑照颜色。\n水深波浪阔,无使蛟龙得。", - "type": "五言古诗", - "author": "杜甫", - "title": "梦李白二首之一" - }, - { - "id": 12, - "contents": "浮云终日行,游子久不至。\n三夜频梦君,情亲见君意。\n告归常局促,苦道来不易。\n江湖多风波,舟楫恐失坠。\n出门搔白首,若负平生志。\n冠盖满京华,斯人独憔悴。\n孰云网恢恢,将老身反累。\n千秋万岁名,寂寞身后事。", - "type": "五言古诗", - "author": "杜甫", - "title": "梦李白二首之二" - }, - { - "id": 13, - "contents": "下马饮君酒,问君何所之。\n君言不得意,归卧南山陲。\n但去莫复闻,白云无尽时。", - "type": "五言古诗", - "author": "王维", - "title": "送别" - }, - { - "id": 14, - "contents": "圣代无隐者,英灵尽来归。\n遂令东山客,不得顾采薇。\n既至金门远,孰云吾道非?\n江淮度寒食,京洛缝春衣。\n置酒长安道,同心与我违。\n行当浮桂棹,未几拂荆扉。\n远树带行客,孤城当落晖。\n吾谋适不用,勿谓知音稀。", - "type": "五言古诗", - "author": "王维", - "title": "送綦毋潜落第还乡" - }, - { - "id": 15, - "contents": "言入黄花川,每逐青溪水。\n随山将万转,趣途无百里。\n声喧乱石中,色静深松里。\n漾漾泛菱荇,澄澄映葭苇。\n我心素已闲,清川澹如此。\n请留盘石上,垂钓将已矣。", - "type": "五言古诗", - "author": "王维", - "title": "青溪" - }, - { - "id": 16, - "contents": "斜光照墟落,穷巷牛羊归。\n野老念牧童,倚杖候荆扉。\n雉[句隹]麦苗秀,蚕眠桑叶稀。\n田夫荷锄立,相见语依依。\n即此羡闲逸,怅然吟式微。", - "type": "五言古诗", - "author": "王维", - "title": "渭川田家" - }, - { - "id": 17, - "contents": "艳色天下重,西施宁久微。\n朝为越溪女,暮作吴宫妃。\n贱日岂殊众,贵来方悟稀。\n邀人傅脂粉,不自著罗衣。\n君宠益娇态,君怜无是非。\n当时浣纱伴,莫得同车归。\n持谢邻家子,效颦安可希!", - "type": "五言古诗", - "author": "王维", - "title": "西施咏" - }, - { - "id": 18, - "contents": "北山白云里,隐者自怡悦。\n相望始登高,心随雁飞灭。\n愁因薄暮起,兴是清秋发。\n时见归村人,沙行渡头歇。\n天边树若荠,江畔洲如月。\n何当载酒来,共醉重阳节。", - "type": "五言古诗", - "author": "孟浩然", - "title": "秋登兰山寄张五" - }, - { - "id": 19, - "contents": "山光忽西落,池月渐东上。\n散发乘夜凉,开轩卧闲敞。\n荷风送香气,竹露滴清响。\n欲取鸣琴弹,恨无知音赏。\n感此怀故人,中宵劳梦想。", - "type": "五言古诗", - "author": "孟浩然", - "title": "夏日南亭怀辛大" - }, - { - "id": 20, - "contents": "夕阳度西岭,群壑倏已暝。\n松月生夜凉,风泉满清听。\n樵人归欲尽,烟鸟栖初定。\n之子期宿来,孤琴候萝径。", - "type": "五言古诗", - "author": "孟浩然", - "title": "宿业师山房待丁大不至" - }, - { - "id": 21, - "contents": "高卧南斋时,开帷月初吐。\n清辉淡水木,演漾在窗户。\n苒苒几盈虚,澄澄变今古。\n美人清江畔,是夜越吟苦。\n千里其如何,微风吹兰杜。", - "type": "五言古诗", - "author": "王昌龄", - "title": "同从弟南斋玩月忆山阴崔少府" - }, - { - "id": 22, - "contents": "绝顶一茅茨,直上三十里。\n扣关无僮仆,窥室惟案几。\n若非巾柴车,应是钓秋水。\n差池不相见,黾勉空仰止。\n草色新雨中,松声晚窗里。\n及兹契幽绝,自足荡心耳。\n虽无宾主意,颇得清净理。\n兴尽方下山,何必待之子。", - "type": "五言古诗", - "author": "邱为", - "title": "寻西山隐者不遇" - }, - { - "id": 23, - "contents": "幽意无断绝,此去随所偶。\n晚风吹行舟,花路入溪口。\n际夜转西壑,隔山望南斗。\n潭烟飞溶溶,林月低向后。\n生事且弥漫,愿为持竿叟。", - "type": "五言古诗", - "author": "綦毋潜", - "title": "春泛若耶溪" - }, - { - "id": 24, - "contents": "清溪深不测,隐处唯孤云。\n松际露微月,清光犹为君。\n茅亭宿花影,药院滋苔纹。\n余亦谢时去,西山鸾鹤群。", - "type": "五言古诗", - "author": "常建", - "title": "宿王昌龄隐居" - }, - { - "id": 25, - "contents": "塔势如涌出,孤高耸天宫。\n登临出世界,磴道盘虚空。\n突兀压神州,峥嵘如鬼工。\n四角碍白日,七层摩苍穹。\n下窥指高鸟,俯听闻惊风。\n连山若波涛,奔凑如朝东。\n青槐夹驰道,宫馆何玲珑!\n秋色从西来,苍然满关中。\n五陵北原上,万古青蒙蒙。\n净理了可悟,胜因夙所宗。\n誓将挂冠去,觉道资无穷。", - "type": "五言古诗", - "author": "岑参", - "title": "与高适薛据登慈恩寺浮图" - }, - { - "id": 26, - "contents": "癸卯岁,西原贼入道州,焚烧杀掠,几尽而去。明年,贼又攻永州,破邵,不犯此\n州边鄙而退,岂力能制敌欤?盖蒙其伤怜而已!诸史何为忍苦征敛!故作诗一篇以\n示官吏。\n昔岁逢太平,山林二十年。\n泉源在庭户,洞壑当门前。\n井税有常期,日晏犹得眠。\n忽然遭时变,数岁亲戎旃。\n今来典斯郡,山夷又纷然。\n城小贼不屠,人贫伤可怜。\n是以陷邻境,此州独见全。\n使臣将王命,岂不如贼焉!\n令彼征敛者,迫之如火煎。\n谁能绝人命,以作时世贤。\n思欲委符节,引竿自刺船。\n将家就鱼麦,归老江湖边。", - "type": "五言古诗", - "author": "元结", - "title": "贼退示官吏并序" - }, - { - "id": 27, - "contents": "兵卫森画戟,宴寝凝清香。\n海上风雨至,逍遥池阁凉。\n烦疴近消散,嘉宾复满堂。\n自惭居处崇,未睹斯民康。\n理会是非遣,性达形迹忘。\n鲜肥属时禁,蔬果幸见尝。\n俯饮一杯酒,仰聆金玉章。\n神欢体自轻,意欲凌风翔。\n吴中盛文史,群彦今汪洋。\n方知大蕃地,岂曰财赋强。", - "type": "五言古诗", - "author": "韦应物", - "title": "郡斋雨中与诸文士燕集" - }, - { - "id": 28, - "contents": "凄凄去亲爱,泛泛入烟雾。\n归棹洛阳人,残钟广陵树。\n今朝为此别,何处还相遇。\n世事波上舟,沿洄安得住。", - "type": "五言古诗", - "author": "韦应物", - "title": "初发扬子寄元大校书" - }, - { - "id": 29, - "contents": "今朝郡斋冷,忽念山中客。\n涧底束荆薪,归来煮白石。\n欲持一瓢酒,远慰风雨夕。\n落叶满空山,何处寻行迹。", - "type": "五言古诗", - "author": "韦应物", - "title": "寄全椒山中道士" - }, - { - "id": 30, - "contents": "客从东方来,衣上灞陵雨。\n问客何为来,采山因买斧。\n冥冥花正开,扬扬燕新乳。\n昨别今已春,鬓丝生几缕。", - "type": "五言古诗", - "author": "韦应物", - "title": "长安遇冯著" - }, - { - "id": 31, - "contents": "落帆逗淮镇,停舫临孤驿。\n浩浩风起波,冥冥日沈夕。\n人归山郭暗,雁下芦洲白。\n独夜忆秦关,听钟未眠客。", - "type": "五言古诗", - "author": "韦应物", - "title": "夕次盱眙县" - }, - { - "id": 32, - "contents": "吏舍局终年,出郊旷清曙。\n杨柳散和风,青山澹吾虑。\n依丛适自憩,缘涧还复去。\n微雨霭芳原,春鸠鸣何处?\n乐幽心屡止,遵事迹犹遽。\n终罢斯结庐,慕陶真可庶。", - "type": "五言古诗", - "author": "韦应物", - "title": "东郊" - }, - { - "id": 33, - "contents": "永日方戚戚,出行复悠悠。\n女子今有行,大江溯轻舟。\n尔辈苦无恃,抚念益慈柔。\n幼为长所育,两别泣不休。\n对此结中肠,义往难复留!\n自小阙内训,事姑贻我忧。\n赖兹托令门,仁恤庶无尤。\n贫俭诚所尚,资从岂待周?\n孝恭遵妇道,容止顺其猷。\n别离在今晨,见尔当何秋。\n居闲始自遣,临感忽难收。\n归来视幼女,零泪缘缨流。", - "type": "五言古诗", - "author": "韦应物", - "title": "送杨氏女" - }, - { - "id": 34, - "contents": "汲井漱寒齿,清心拂尘服。\n闲持贝叶书,步出东斋读。\n真源了无取,忘迹世所逐。\n遗言冀可冥,缮性何由熟?\n道人庭宇静,苔色连深竹。\n日出雾露馀,青松如膏沐。\n澹然离言说,悟悦心自足。", - "type": "五言古诗", - "author": "柳宗元", - "title": "晨诣超师院读禅经" - }, - { - "id": 35, - "contents": "久为簪组累,幸此南夷谪。\n闲依农圃邻,偶似山林客。\n晓耕翻露草,夜榜响溪石。\n来往不逢人,长歌楚天碧。", - "type": "五言古诗", - "author": "柳宗元", - "title": "溪居" - }, - { - "id": 36, - "contents": "蝉鸣空桑林,八月萧关道。\n出塞复入塞,处处黄芦草。\n从来幽并客,皆向沙场老。\n莫学游侠儿,矜夸紫骝好。", - "type": "五言乐府", - "author": "王昌龄", - "title": "塞上曲" - }, - { - "id": 37, - "contents": "饮马渡秋水,水寒风似刀。\n平沙日未没,黯黯见临洮。\n昔日长城战,咸言意气高。\n黄尘足今古,白骨乱蓬蒿。", - "type": "五言乐府", - "author": "王昌龄", - "title": "塞下曲" - }, - { - "id": 38, - "contents": "明月出天山,苍茫云海间。\n长风几万里,吹度玉门关。\n汉下白登道,胡窥青海湾。\n由来征战地,不见有人还。\n戍客望边色,思归多苦颜。\n高楼当此夜,叹息未应闲。", - "type": "五言乐府", - "author": "李白", - "title": "关山月" - }, - { - "id": 39, - "contents": "秦地罗敷女,采桑绿水边。\n素手青条上,红妆白日鲜。\n蚕饥妾欲去,五马莫留连。", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:春歌" - }, - { - "id": 40, - "contents": "镜湖三百里,菡萏发荷花。\n五月西施采,人看隘若耶。\n回舟不待月,归去越王家。", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:夏歌" - }, - { - "id": 41, - "contents": "长安一片月,万户捣衣声。\n秋风吹不尽,总是玉关情。\n何日平胡虏,良人罢远征?", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:秋歌" - }, - { - "id": 42, - "contents": "明朝驿使发,一夜絮征袍。\n素手抽针冷,那堪把剪刀。\n裁缝寄远道,几日到临洮?", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:冬歌" - }, - { - "id": 43, - "contents": "妾发初覆额,折花门前剧。\n郎骑竹马来,绕床弄青梅。\n同居长干里,两小无嫌猜。\n十四为君妇,羞颜未尝开。\n低头向暗壁,千唤不一回。\n十五始展眉,愿同尘与灰。\n常存抱柱信,岂上望夫台!\n十六君远行,瞿塘滟预堆。\n五月不可触,猿鸣天上哀。\n门前迟行迹,一一生绿苔。\n苔深不能扫,落叶秋风早。\n八月蝴蝶来,双飞西园草。\n感此伤妾心,坐愁红颜老。\n早晚下三巴,预将书报家。\n相迎不道远,直至长风沙。", - "type": "五言乐府", - "author": "李白", - "title": "长干行" - }, - { - "id": 44, - "contents": "梧桐相待老,鸳鸯会双死。\n贞妇贵殉夫,舍生亦如此。\n波澜誓不起,妾心井中水。", - "type": "五言乐府", - "author": "孟郊", - "title": "烈女操" - }, - { - "id": 45, - "contents": "慈母手中线,游子身上衣。\n临行密密缝,意恐迟迟归。\n谁言寸草心,报得三春辉?", - "type": "五言乐府", - "author": "孟郊", - "title": "游子吟" - }, - { - "id": 46, - "contents": "前不见古人,后不见来者。\n念天地之悠悠,独怆然而涕下!", - "type": "五言乐府", - "author": "陈子昂", - "title": "登幽州台歌" - }, - { - "id": 47, - "contents": "男儿事长征,少小幽燕客。\n赌胜马蹄下,由来轻七尺。\n杀人莫敢前,须如猬毛磔。\n黄云陇底白雪飞,未得报恩不能归。\n辽东小妇年十五,惯弹琵琶解歌舞。\n今为羌笛出塞声,使我三军泪如雨!", - "type": "七言古诗", - "author": "李颀", - "title": "古意" - }, - { - "id": 48, - "contents": "四月南风大麦黄,枣花未落桐叶长。\n青山朝别暮还见,嘶马出门思故乡。\n陈侯立身何坦荡,虬须虎眉仍大颡。\n腹中贮书一万卷,不肯低头在草莽。\n东门酤酒饮我曹,心轻万事皆鸿毛。\n醉卧不知白日暮,有时空望孤云高。\n长河浪头连天黑,津口停舟渡不得。\n郑国游人未及家,洛阳行子空叹息。\n闻道故林相识多,罢官昨日今如何?", - "type": "七言古诗", - "author": "李颀", - "title": "送陈章甫" - }, - { - "id": 49, - "contents": "主人有酒欢今夕,请奏鸣琴广陵客。\n月照城头乌半飞,霜凄万树风入衣。\n铜炉华烛烛增辉,初弹渌水后楚妃。\n一声已动物皆静,四座无言星欲稀。\n清淮奉使千馀里,敢告云山从此始?", - "type": "七言古诗", - "author": "李颀", - "title": "琴歌" - }, - { - "id": 50, - "contents": "蔡女昔造胡笳声,一弹一十有八拍。\n胡人落泪沾边草,汉使断肠对归客。\n古戍苍苍烽火寒,大荒沈沈飞雪白。\n先拂声弦后角羽,四郊秋叶惊[扌戚][扌戚]。\n董夫子,通神明,深山窃听来妖精。\n言迟更速皆应手,将往复旋如有情。\n空山百鸟散还合,万里浮云阴且晴。\n嘶酸雏雁失群夜,断绝胡儿恋母声。\n川为静其波,鸟亦罢其鸣。\n乌孙部落家乡远,逻娑沙尘哀怨生。\n幽音变调忽飘洒,长风吹林雨堕瓦。\n迸泉飒飒飞木末,野鹿呦呦走堂下。\n长安城连东掖垣,凤凰池对青琐门。\n高才脱略名与利,日夕望君抱琴至。", - "type": "七言古诗", - "author": "李颀", - "title": "听董大弹胡笳声兼寄语弄房给事" - }, - { - "id": 51, - "contents": "南山截竹为筚篥,此乐本自龟兹出。\n流传汉地曲转奇,凉州胡人为我吹。\n傍邻闻者多叹息,远客思乡皆泪垂。\n世人解听不解赏,长飙风中自来往。\n枯桑老柏寒飕[风留],九雏鸣凤乱啾啾。\n龙吟虎啸一时发,万籁百泉相与秋。\n忽然更作渔阳掺,黄云萧条白日暗。\n变调如闻杨柳春,上林繁花照眼新。\n岁夜高堂列明烛,美酒一杯声一曲。", - "type": "七言古诗", - "author": "李颀", - "title": "听安万善吹筚篥歌" - }, - { - "id": 52, - "contents": "山寺钟鸣昼已昏,渔梁渡头争渡喧。\n人随沙路向江村,余亦乘舟归鹿门。\n鹿门月照开烟树,忽到庞公栖隐处。\n岩扉松径长寂寥,惟有幽人自来去。", - "type": "七言古诗", - "author": "孟浩然", - "title": "夜归鹿门山歌" - }, - { - "id": 53, - "contents": "我本楚狂人,凤歌笑孔丘。\n手持绿玉杖,朝别黄鹤楼。\n五岳寻仙不辞远,一生好入名山游。\n庐山秀出南斗傍,屏风九叠云锦张。\n影落明湖青黛光,金阙前开二峰长。\n银河倒挂三石梁,香炉瀑布遥相望。\n回崖沓障凌苍苍。\n翠影红霞映朝日,鸟飞不到吴天长。\n登高壮观天地间,大江茫茫去不黄。\n黄云万里动风色,白波九道流雪山。\n好为庐山谣,兴因庐山发。\n闲窥石镜清我心,谢公行处苍苔没。\n早服还丹无世情,琴心三叠道初成。\n遥见仙人彩云里,手把芙蓉朝玉京。\n先期汗漫九垓上,愿接卢敖游太清。", - "type": "七言古诗", - "author": "李白", - "title": "庐山谣寄卢侍御虚舟" - }, - { - "id": 54, - "contents": "海客谈瀛洲,烟涛微茫信难求。\n越人语天姥,云霓明灭或可睹。\n天姥连天向天横,势拔五岳掩赤城。\n天台四万八千丈,对此欲倒东南倾。\n我欲因之梦吴越,一夜飞渡镜湖月。\n湖月照我影,送我至剡溪。\n谢公宿处今尚在,渌水荡漾清猿啼。\n脚著谢公屐,身登青云梯。\n半壁见海日,空中闻天鸡。\n千岩万壑路不定,迷花倚石忽已暝。\n熊咆龙吟殷岩泉,栗深林兮惊层巅。\n云青青兮欲雨,水澹澹兮生烟。\n裂缺霹雳,丘峦崩摧。\n洞天石扇,訇然中开。\n青冥浩荡不见底,日月照耀金银台。\n霓为衣兮风为马,云之君兮纷纷而来下。\n虎鼓瑟兮鸾回车,仙之人兮列如麻。\n忽魂悸以魄动,恍惊起而长嗟。\n惟觉时之枕席,失向来之烟霞。\n世间行乐亦如此,古来万事东流水。\n别君去兮何时还?且放白鹿青崖间。\n须行即骑访名山。\n安能摧眉折腰事权贵,使我不得开心颜!", - "type": "七言古诗", - "author": "李白", - "title": "梦游天姥吟留别" - }, - { - "id": 55, - "contents": "风吹柳花满店香,吴姬压酒唤客尝。\n金陵子弟来相送,欲行不行各尽觞。\n请君试问东流水,别意与之谁短长?", - "type": "七言古诗", - "author": "李白", - "title": "金陵酒肆留别" - }, - { - "id": 56, - "contents": "弃我去者,昨日之日不可留。\n乱我心者,今日之日多烦忧!\n长风万里送秋雁,对此可以酣高楼。\n蓬莱文章建安骨,中间小谢又清发。\n俱怀逸兴壮思飞,欲上青天览明月。\n抽刀断水水更流,举杯销愁愁更愁。\n人生在世不称意,明朝散发弄扁舟。", - "type": "七言古诗", - "author": "李白", - "title": "宣州谢[月兆]楼饯别校书叔云" - }, - { - "id": 57, - "contents": "君不见走马川行雪海边,平沙莽莽黄入天。\n轮台九月风夜吼,一川碎石大如斗。\n随风满地石乱走,匈奴草黄马正肥。\n金山西见烟尘飞,汉家大将西出师。\n将军金甲夜不脱,半夜军行戈相拨。\n风头如刀面如割,马毛带雪汗气蒸。\n五花连钱旋作冰,幕中草檄砚水凝。\n虏骑闻之应胆慑,料知短兵不敢接。\n车师西门伫献捷!", - "type": "七言古诗", - "author": "岑参", - "title": "走马川行奉送封大夫出师西征" - }, - { - "id": 58, - "contents": "轮台城头夜吹角,轮台城北旄头落。\n羽书昨夜过渠黎,单于已在金山西。\n戍楼西望烟尘黑,汉兵屯在轮台北。\n上将拥旄西出征,平明吹笛大军行。\n四边伐鼓雪海涌,三军大呼阴山动。\n虏塞兵气连云屯,战场白骨缠草根。\n剑河风急雪片阔,沙口石冻马蹄脱。\n亚相勤王甘苦辛,誓将报主静边尘。\n古来青史谁不见,今见功名胜古人。", - "type": "七言古诗", - "author": "岑参", - "title": "轮台歌奉送封大夫出师西征" - }, - { - "id": 59, - "contents": "北风卷地白草折,胡天八月即飞雪。\n忽如一夜春风来,千树万树梨花开。\n散入珠帘湿罗幕,狐裘不暖锦衾薄。\n将军角弓不得控,都护铁衣冷犹著。\n瀚海阑干百丈冰,愁云黪淡万里凝。\n中军置酒饮归客,胡琴琵琶与羌笛。\n纷纷暮雪下辕门,风掣红旗冻不翻。\n轮台东门送君去,去时雪满天山路。\n山回路转不见君,雪上空留马行处。", - "type": "七言古诗", - "author": "岑参", - "title": "白雪歌送武判官归京" - }, - { - "id": 60, - "contents": "国初以来画鞍马,神妙独数江都王。\n将军得名三十载,人间又见真乘黄。\n曾貌先帝照夜白,龙池十日飞霹雳。\n内府殷红玛瑙盘,婕妤传诏才人索。\n盘赐将军拜舞归,轻纨细绮相追飞。\n贵戚权门得笔迹,始觉屏障生光辉。\n昔日太宗拳毛[马呙],近时郭家狮子花。\n今之新图有二马。复令识者久叹嗟。\n此皆骑战一敌万,缟素漠漠开风沙。\n其余七匹亦殊绝,迥若寒空杂烟雪。\n霜蹄蹴踏长楸间,马官厮养森成列。\n可怜九马争神骏,顾视清高气深稳。\n借问苦心爱者谁,后有韦讽前支盾。\n忆昔巡幸新丰宫,翠花拂天来向东。\n腾骧磊落三万匹,皆与此图筋骨同。\n自从献宝朝河宗,无复射蛟江水中。\n君不见,金粟堆前松柏里。龙媒去尽鸟呼风。", - "type": "七言古诗", - "author": "杜甫", - "title": "韦讽录事宅观曹将军画马图" - }, - { - "id": 61, - "contents": "将军魏武之子孙,于今为庶为青门。\n英雄割据虽已矣,文采风流今尚存。\n学书初学卫夫人,但恨无过王右军。\n丹青不知老将至,富贵于我如浮云。\n开元之中常引见,承恩数上南熏殿。\n凌烟功臣少颜色,将军下笔开生面。\n良相头上进贤冠,猛将腰间大羽箭。\n褒公鄂公毛发动,英姿飒爽犹酣战。\n先帝天马玉花骢,画工如山貌不同。\n是日牵来赤墀下,迥立阊阖生长风。\n诏谓将军拂绢素,意匠惨淡经营中。\n斯须九重真龙出,一洗万古凡马空。\n玉花却在御榻上,榻上庭前屹相向。\n至尊含笑催赐金,圉人太仆皆惆怅。\n弟子韩干早入室,亦能画马穷殊相。\n干惟画肉不画骨,忍使骅骝气凋丧。\n将军画善盖有神,偶逢佳士亦写真。\n即今漂泊干戈际,屡貌寻常行路人。\n涂穷反遭俗眼白,世上未有如公贫。\n但看古来盛名下,终日坎[土禀]缠其身!", - "type": "七言古诗", - "author": "杜甫", - "title": "丹青引赠曹霸将军" - }, - { - "id": 62, - "contents": "今我不乐思岳阳,身欲奋飞病在床。\n美人娟娟隔秋水,濯足洞庭望八荒。\n鸿飞冥冥日月白,青枫叶赤天雨霜。\n玉京群帝集北斗,或骑麒麟翳凤凰。\n芙蓉旌旗烟雾落,影动倒景摇潇湘。\n星宫之君醉琼浆,羽人稀少不在旁。\n似闻昨者赤松子,恐是汉代韩张良。\n昔随刘氏定长安,帷幄未改神惨伤。\n国家成败吾岂敢,色难腥腐餐枫香。\n周南留滞古所惜,南极老人应寿昌。\n美人胡为隔秋水,焉得置之贡玉堂?", - "type": "七言古诗", - "author": "杜甫", - "title": "寄韩谏议" - }, - { - "id": 63, - "contents": "孔明庙前有老柏,柯如青铜根如石。\n双皮溜雨四十围,黛色参天二千尺。\n君臣已与时际会,树木犹为人爱惜。\n云来气接巫峡长,月出寒通雪山白。\n忆昨路绕锦亭东,先主武侯同[门必]宫。\n崔嵬枝干郊原古,窈窕丹青户牖空。\n落落盘踞虽得地,冥冥孤高多烈风。\n扶持自是神明力,正直元因造化功。\n大厦如倾要梁栋,万牛回首丘山重。\n不露文章世已惊,未辞剪伐谁能送?\n苦心岂免容蝼蚁?香叶终经宿鸾凤。\n志士幽人莫怨嗟,古来材大难为用!", - "type": "七言古诗", - "author": "杜甫", - "title": "古柏行" - }, - { - "id": 64, - "contents": "大历二年十月十九日夔府别驾元持宅见临颍李十二娘舞剑器,壮其蔚[足支]。问\n其所师,曰:余公孙大娘弟子也。开元三载,余尚童稚,记于郾城观公孙氏舞剑器\n浑脱。浏漓顿挫,独出冠时。自高头宜春梨园二伎坊内人,洎外供奉,晓是舞者,\n圣文神武皇帝初,公孙一人而已。玉貌锦衣,况余白首!今兹弟子亦匪盛颜。既辨\n其由来,知波澜莫二。抚事慷慨,聊为剑器行。昔者吴人张旭善草书书帖,数尝於\n邺县见公孙大娘舞西河剑器,自此草书长进,豪荡感激。即公孙可知矣!\n昔有佳人公孙氏,一舞剑器动四方。\n观者如山色沮丧,天地为之久低昂。\n霍如羿射九日落,矫如群帝骖龙翔。\n来如雷霆收震怒,罢如江海凝清光。\n绛唇珠袖两寂寞,晚有弟子传芬芳。\n临颍美人在白帝,妙舞此曲神扬扬。\n与余问答既有以,感时抚事增惋伤。\n先帝侍女八千人,公孙剑器初第一。\n五十年间似反掌,风尘[氵项]洞昏王室。\n梨园子弟散如烟,女乐馀姿映寒日。\n金粟堆前木已拱,瞿塘石城草萧瑟。\n玳筵急管曲复终,乐极哀来月东出。\n老夫不知其所往,足茧荒山转愁疾。", - "type": "七言古诗", - "author": "杜甫", - "title": "观公孙大娘弟子舞剑器行并序" - }, - { - "id": 65, - "contents": "漫叟以公田米酿酒,因休暇,则载酒于湖上,\n时取一醉;欢醉中,据湖岸,引臂向鱼取酒,\n使舫载之,遍饮坐者。意疑倚巴丘,酌於君山\n之上,诸子环洞庭而坐,酒舫泛泛然,触波涛\n而往来者,乃作歌以长之。\n石鱼湖,似洞庭,夏水欲满君山青。\n山为樽,水为沼,酒徒历历坐洲鸟。\n长风连日作大浪,不能废人运酒舫。\n我持长瓢坐巴丘,酌饮四座以散愁。", - "type": "七言古诗", - "author": "元结", - "title": "石鱼湖上醉歌并序" - }, - { - "id": 66, - "contents": "山石荦确行径微,黄昏到寺蝙蝠飞。\n升堂坐阶新雨足,芭蕉叶大栀子肥。\n僧言古壁佛画好,以火来照所见稀。\n铺床拂席置羹饭,疏粝亦足饱我饥。\n夜深静卧百虫绝,清月出岭光入扉。\n天明独去无道路,出入高下穷烟霏。\n山红涧碧纷烂漫,时见松枥皆十围。\n当流赤足蹋涧石,水声激激风吹衣。\n人生如此自可乐,岂必局束为人[革几]!\n嗟哉吾党二三子,安得至老不更归!", - "type": "七言古诗", - "author": "韩愈", - "title": "山石" - }, - { - "id": 67, - "contents": "纤云四卷天无河,清风吹空月舒波。\n沙平水息声影绝,一杯相属君当歌。\n君歌声酸辞且苦,不能听终泪如雨。\n洞庭连天九嶷高,蛟龙出没猩鼯号。\n十生九死到官所,幽居默默如藏逃。\n下床畏蛇食畏药,海气湿蛰熏腥臊。\n昨者州前槌大鼓,嗣皇继圣登夔皋。\n赦书一日行万里,罪从大辟皆除死。\n迁者追回流者还,涤瑕荡垢清朝班。\n州家申名使家抑,坎轲只得移荆蛮。\n判司卑官不堪说,未免捶楚尘埃间。\n同时辈流多上道,天路幽险难追攀。\n君歌且休听我歌,我歌今与君殊科。\n一年明月今宵多,人生由命非由他。\n有酒不饮奈明何!", - "type": "七言古诗", - "author": "韩愈", - "title": "八月十五夜赠张功曹" - }, - { - "id": 68, - "contents": "五岳祭秩皆三公,四方环镇嵩当中。\n火维地荒足妖怪,天假神柄专其雄。\n喷云泄雾藏半腹,虽有绝顶谁能穷?\n我来正逢秋雨节,阴气晦昧无清风。\n潜心默祷若有应,岂非正直能感通!\n须臾静扫众峰出,仰见突兀撑青空。\n紫盖连延接天柱,石廪腾掷堆祝融。\n森然魄动下马拜,松柏一迳趋灵宫。\n纷墙丹柱动光彩,鬼物图画填青红。\n升阶伛偻荐脯酒,欲以菲薄明其衷。\n庙内老人识神意,睢盱侦伺能鞠躬。\n手持杯[王交]导我掷,云此最吉馀难同。\n窜逐蛮荒幸不死,衣食才足甘长终。\n侯王将相望久绝,神纵欲福难为功!\n夜投佛寺上高阁,星月掩映云[日童][日龙]。\n猿鸣钟动不知曙,杲杲寒日生于东。", - "type": "七言古诗", - "author": "韩愈", - "title": "谒衡岳庙遂宿岳寺题门楼" - }, - { - "id": 69, - "contents": "张生手持石鼓文,劝我识作石鼓歌。\n少陵无人谪仙死,才薄将奈石鼓何!\n周纲凌迟四海沸,宣王愤起挥天戈。\n大开明堂受朝贺,诸侯剑佩鸣相磨。\n搜于岐阳骋雄俊,万里禽兽皆遮罗。\n镌功勒成告万世,凿石作鼓隳嵯峨。\n从臣才艺咸第一,拣选撰刻留山阿。\n雨淋日炙野火燎,鬼物守护烦[扌为]呵。\n公从何处得纸本?毫发尽备无差讹。\n辞严义密读难晓,字体不类隶与蝌。\n年深岂免有缺画,快剑砍断生蛟鼍。\n鸾翔凤翥众仙下,珊瑚碧树交枝柯。\n金绳铁索锁钮壮,古鼎跃水龙腾梭。\n陋儒编诗不收入,二雅褊迫无委蛇。\n孔子西行不到秦,掎摭星宿遗羲娥。\n嗟予好古生苦晚,对此涕泪双滂沱。\n忆昔初蒙博士征,其年始改称元和。\n故人从军在右辅,为我度量掘臼科。\n濯冠沐浴告祭酒,如此至宝存岂多!\n毡包席裹可立致,十鼓只载数骆驼。\n荐诸太庙比郜鼎,光价岂止百倍过!\n圣恩若许留太学,诸生讲解得切磋。\n观经鸿都尚填咽,坐见举国来奔波。\n剜苔剔藓露节角,安置妥帖平不颇。\n大厦深檐与盖覆,经历久远期无佗。\n中朝大官老于事,讵肯感激徒□(“妍”右上一横改为“合”)婀。\n牧童敲火牛砺角,谁复著手为摩挲?\n日销月铄就埋没,六年西顾空吟哦。\n羲之俗书趁姿媚,数纸尚可博白鹅。\n继周八代争战罢,无人收拾理则那。\n方今太平日无事,柄任儒术崇丘轲。\n安能以此上论列,愿借辩口如悬河。\n石鼓之歌止于此,呜呼吾意其蹉跎!", - "type": "七言古诗", - "author": "韩愈", - "title": "石鼓歌" - }, - { - "id": 70, - "contents": "渔翁夜傍西岩宿,晓汲清湘燃楚烛。\n烟销日出不见人,[矣欠]乃一声山水绿。\n回看天际下中流,岩上无心云相逐。", - "type": "七言古诗", - "author": "柳宗元", - "title": "渔翁" - }, - { - "id": 71, - "contents": "汉皇重色思倾国,御宇多年求不得。\n杨家有女初长成,养在深闺人未识。\n天生丽质难自弃,一朝选在君王侧。\n回眸一笑百媚生,六宫粉黛无颜色。\n春寒赐浴华清池,温泉水滑洗凝脂。\n侍儿扶起娇无力,始是新承恩泽时。\n云鬓花颜金步摇,芙蓉帐暖度春宵。\n春宵苦短日高起,从此君王不早朝。\n承欢侍宴无闲暇,春从春游夜专夜。\n后宫佳丽三千人,三千宠爱在一身。\n金星妆成娇侍夜,玉楼宴罢醉和春。\n姊妹弟兄皆列士,可怜光彩生门户。\n遂令天下父母心,不重生男重生女。\n骊宫高处入青云,仙乐风飘处处闻。\n缓歌慢舞凝丝竹,尽日君王看不足。\n渔阳鼙鼓动地来,惊破霓裳羽衣曲。\n九重城阙烟尘生,千乘万骑西南行。\n翠华摇摇行复止,西出都门百馀里。\n六军不发无奈何,宛转蛾眉马前死。\n花钿委地无人收,翠翘金雀玉搔头。\n君王掩面救不得,回看血泪相和流。\n黄埃散漫风萧索,云栈萦纡登剑阁。\n峨嵋山下少人行,旌旗无光日色薄。\n蜀江水碧蜀山青,圣主朝朝暮暮情。\n行宫见月伤心色,夜雨闻铃肠断声。\n天旋地转回龙驭,到此踌躇不能去。\n马嵬坡下泥土中,不见玉颜空死处。\n君臣相顾尽沾衣,东望都门信马归。\n归来池苑皆依旧,太液芙蓉未央柳。\n芙蓉如面柳如眉,对此如何不泪垂!\n春风桃李花开日,秋雨梧桐叶落时。\n西宫南内多秋草,落叶满阶红不扫。\n梨园子弟白发新,椒房阿监青娥老。\n夕殿萤飞思悄然,孤灯挑尽未成眠。\n迟迟钟鼓初长夜,耿耿星河欲曙天。\n鸳鸯瓦冷霜华重,翡翠衾寒谁与共?\n悠悠生死别经年,魂魄不曾来入梦。\n临邛道士鸿都客,能以精诚致魂魄。\n为感君王辗转思,遂教方士殷勤觅。\n排空驭气奔如电,升天入地求之遍。\n上穷碧落下黄泉,两处茫茫皆不见。\n忽闻海上有仙山,山在虚无缥缈间。\n楼阁玲珑五云起,其中绰约多仙子。\n中有一人字太真,雪肤花貌参差是。\n金阙西厢叩玉扃,转教小玉报双成。\n闻道汉家天子使,九华帐里梦魂惊。\n揽衣推枕起徘徊,珠箔银屏迤逦开。\n云鬓半偏新睡觉,花冠不整下堂来。\n风吹仙袂飘飘举,犹似霓裳羽衣舞。\n玉容寂寞泪阑干,梨花一枝春带雨。\n含情凝睇谢君王,一别音容两渺茫。\n昭阳殿里恩爱绝,蓬莱宫中日月长。\n回头下望人寰处,不见长安见尘雾。\n唯将旧物表深情,钿合金钗寄将去。\n钗留一股合一扇,钗擘黄金合分钿。\n但教心似金钿坚,天上人间会相见。\n临别殷勤重寄词,词中有誓两心知。\n七月七日长生殿,夜半无人私语时。\n在天愿作比翼鸟,在地愿为连理枝。\n天长地久有时尽,此恨绵绵无绝期!", - "type": "七言古诗", - "author": "白居易", - "title": "长恨歌" - }, - { - "id": 72, - "contents": "元和十年,予左迁九江郡司马。明年秋,送客湓浦口,闻船中夜弹琵琶者,听其音\n,铮铮然有京都声;问其人,本长安倡女,尝学琵琶於穆曹二善才。年长色衰,委\n身为贾人妇。遂命酒,使快弹数曲,曲罢悯然。自叙少小时欢乐事,今漂沦憔悴,\n转徙於江湖间。予出官二年恬然自安,感斯人言,是夕,始觉有迁谪意,因为长句\n歌以赠之,凡六百一十六言,命曰琵琶行。\n浔言江头夜送客,枫叶荻花秋瑟瑟。\n主人下马客在船,举酒欲饮无管弦。\n醉不成欢惨将别,别时茫茫江浸月。\n忽闻水上琵琶声,主人忘归客不发。\n寻声暗问弹者谁,琵琶声停欲语迟。\n移船相近邀相见,添酒回灯重开宴。\n千呼万唤始出来,犹抱琵琶半遮面。\n转轴拨弦三两声,未成曲调先有情。\n弦弦掩抑声声思,似诉平生不得志。\n低眉信手续续弹,说尽心中无限事。\n轻拢慢捻抹复挑,初为霓裳后六么。\n大弦嘈嘈如急雨,小弦切切如私语。\n嘈嘈切切错杂弹,大珠小珠落玉盘。\n间关莺语花底滑,幽咽泉流水下滩。\n水泉冷涩弦凝绝,凝绝不通声渐歇。\n别有幽愁暗恨生,此时无声胜有声。\n银瓶乍破水浆迸,铁骑突出刀枪鸣。\n曲终收拨当心画,四弦一声如裂帛。\n东船西舫悄无言,唯见江心秋月白。\n沈吟放拨插弦中,整顿衣裳起敛容。\n自言本是京城女,家在虾蟆陵下住。\n十三学得琵琶成,名属教坊第一部。\n曲罢曾教善才服,妆成每被秋娘妒。\n五陵年少争缠头,一曲红绡不知数。\n钿头银篦击节碎,血色罗裙翻酒污。\n今年欢笑复明年,秋月春风等闲度。\n弟走从军阿姨死,暮去朝来颜色故。\n门前冷落车马稀,老大嫁作商人妇。\n商人重利轻别离,前月浮梁买茶去。\n去来江口守空船,绕船月明江水寒。\n夜深忽梦少年事,梦啼妆泪红阑干。\n我闻琵琶已叹息,又闻此语重唧唧。\n同是天涯沦落人,相逢何必曾相识!\n我从去年辞帝京,谪居卧病浔阳城。\n浔阳地僻无音乐,终岁不闻丝竹声。\n住近湓江地低湿,黄芦苦竹绕宅生。\n其间旦暮闻何物?杜鹃啼血猿哀鸣。\n春江花朝秋月夜,往往取酒还独倾。\n岂无山歌与村笛,呕哑嘲哳难为听!\n今夜闻君琵琶语,如听仙乐耳暂明。\n莫辞更坐弹一曲,为君翻作琵琶行。\n感我此言良久立,却坐促弦弦转急。\n凄凄不似向前声,满座重闻皆掩泣。\n座中泣下谁最多,江州司马青衫湿!", - "type": "七言古诗", - "author": "白居易", - "title": "琵琶行并序" - }, - { - "id": 73, - "contents": "元和天子神武姿,彼何人哉轩与羲。\n誓将上雪列圣耻,坐法宫中朝四夷。\n淮西有贼五十载,封狼生[豸区][豸区]生罴。\n不据山河据平地,长戈利矛日可麾。\n帝得圣相相曰度,贼斫不死神扶持。\n腰悬相印作都统,阴风惨澹天王旗。\n□(上朔下心]武古通作牙爪,仪曹外郎载笔随。\n行军司马智且勇,十四万众犹虎貔。\n入蔡缚贼献太庙,功无与让恩不訾。\n帝曰汝度功第一,汝从事愈宜为辞。\n愈拜稽首蹈且舞,金石刻画臣能为。\n古者世称大手笔,此事不系于职司。\n当仁自古有不让,言讫屡颔天子颐。\n公退斋戒坐小阁,濡染大笔何淋漓!\n点窜尧典舜典字,涂改清庙生民诗。\n文成破体书在纸,清晨再拜铺丹墀。\n表曰臣愈昧死上,咏神圣功书之碑。\n碑高三丈字如斗,负以灵鳌蟠以螭。\n句奇语重喻者少,谗之天子言其私。\n长绳百尺拽碑倒,粗沙大石相磨治。\n公之斯文若元气,先时已入人肝脾。\n汤盘孔鼎有述作,今无其器存其辞。\n呜呼圣皇及圣相,相与[火亘]赫流淳熙。\n公之斯文不示后,曷与三五相攀追。\n愿书万本诵万过,口角流沫右手胝。\n传之七十有二代,以为封禅玉检明堂基。", - "type": "七言古诗", - "author": "李商隐", - "title": "韩碑" - }, - { - "id": 74, - "contents": "开元二十六年,客有从御史大夫张公出塞而还者,作燕歌行以示适,感征戍之事,\n因而和焉。\n汉家烟尘在东北,汉将辞家破残贼。\n男儿本自重横行,天子非常赐颜色。\n[扌从]金伐鼓下榆关,旌旆逶迤碣石间。\n校尉羽书飞瀚海,单于猎火照狼山。\n山川萧条极边土,胡骑凭陵杂风雨。\n战士军前半死生,美人帐下犹歌舞。\n大漠穷秋塞草衰,孤城落日斗兵稀。\n身当恩遇常轻敌,力尽关山未解围。\n铁衣远戍辛勤久,玉筋应啼别离后。\n少妇城南欲断肠,征人蓟北空回首。\n边庭飘摇那可度,绝域苍茫更何有!\n杀气三时作阵云,寒声一夜传刁斗。\n相看白刃血纷纷,死节从来岂顾勋?\n君不见沙场征战苦,至今犹忆李将军!", - "type": "七言乐府", - "author": "高适", - "title": "燕歌行并序" - }, - { - "id": 75, - "contents": "白日登山望烽火,黄昏饮马傍交河。\n行人刁斗风沙暗,公主琵琶幽怨多。\n野云万里无城郭,雨雪纷纷连大漠。\n胡雁哀鸣夜夜飞,胡儿眼泪双双落。\n闻道玉门犹被遮,应将性命逐轻车。\n年年战骨埋荒外,空见葡萄入汉家。", - "type": "七言乐府", - "author": "李颀", - "title": "古从军行" - }, - { - "id": 76, - "contents": "洛阳女儿对门居,才可容颜十五馀。\n良人玉勒乘骢马,侍女金盘脍鲤鱼。\n画阁朱楼尽相望,红桃绿柳垂檐向。\n罗帷送上七香车,宝扇迎归九华帐。\n狂夫富贵在青春,意气骄奢剧季伦。\n自怜碧玉亲教舞,不惜珊瑚持与人。\n春窗曙灭九微火,九微片片飞花琐。\n戏罢曾无理曲时,妆成只是薰香坐。\n城中相识尽繁华,日夜经过赵李家。\n谁怜越女颜如玉,贫贱江头自浣纱!", - "type": "七言乐府", - "author": "王维", - "title": "洛阳女儿行" - }, - { - "id": 77, - "contents": "少年十五二十时,步行夺得胡马骑。\n射杀山中白额虎,肯数邺下黄须儿!\n一身转战三千里,一剑曾当百万师。\n汉兵奋迅如霹雳,虏骑崩腾畏蒺藜。\n卫青不败由天幸,李广无功缘数奇。\n自从弃置便衰朽,世事蹉跎成白首。\n昔时飞箭无全目,今日垂杨生左肘。\n路旁时卖故侯瓜,门前学种先生柳。\n苍茫古木连穷巷,寥落寒山对虚牖。\n誓令疏勒出飞泉,不似颍川空使酒。\n贺兰山下阵如云,羽檄交驰日夕闻。\n节使三河募年少,诏书五道出将军。\n试拂铁衣如雪色,聊持宝剑动星文。\n愿得燕弓射大将,耻令越甲鸣吾君。\n莫嫌旧日云中守,犹堪一战取功勋!", - "type": "七言乐府", - "author": "王维", - "title": "老将行" - }, - { - "id": 78, - "contents": "渔舟逐水爱山春,两岸桃花夹古津。\n坐看红树不知远,行尽青溪不见人。\n山口潜行始隈[阝奥],山开旷望旋平陆。\n遥看一处攒云树,近入千家散花竹。\n樵客初传汉姓名,居人未改秦衣服。\n居人共住武陵源,还从物外起田园。\n月明松下房栊静,日出云中鸡犬喧。\n惊闻俗客争来集,竞引还家问都邑。\n平明闾巷扫花开,薄暮渔樵乘水入。\n初因避地去人间,及至成仙遂不还。\n峡里谁知有人事?世中遥望空云山。\n不疑灵境难闻见,尘心未尽思乡县。\n出洞无论隔山水,辞家终拟长游衍。\n自谓经过旧不迷,安知峰壑今来变?\n当时只记入山深,青溪几曲到云林。\n春来遍是桃花水,不辨仙源何处寻。", - "type": "七言乐府", - "author": "王维", - "title": "桃源行" - }, - { - "id": 79, - "contents": "噫吁戏,危乎高哉!\n蜀道之难难于上青天!\n蚕丛及鱼凫,开国何茫然!\n尔来四万八千岁,始与秦塞通人烟。\n西当太白有鸟道,可以横绝峨眉巅。\n地崩山摧壮士死,然后天梯石栈方钩连。\n上有六龙回日之高标,下有冲波逆折之回川。\n黄鹤之飞尚不得,猿猱欲度愁攀援。\n青泥何盘盘,百步九折萦岩峦。\n扪参历井仰胁息,以手抚膺坐长叹。\n问君西游何时还?畏途□(繁体“谗”换山旁)岩不可攀!\n但见悲鸟号古木,雄飞雌从绕林间。\n又闻子规啼,夜月愁空山。\n蜀道之难难于上青天!使人听此凋朱颜。\n连峰去天不盈尺,枯松倒挂倚绝壁。\n飞湍瀑流争喧[兀豕],冰崖转石万壑雷。\n其险也如此!\n嗟尔远道之人,胡为乎来哉?\n剑阁峥嵘而崔嵬。\n一夫当关,万夫莫开。\n所守或匪亲,化为狼与豺。\n朝避猛虎,夕避长蛇。\n磨牙吮血,杀人如麻。\n锦城虽云乐,不如早还家。\n蜀道之难难于上青天!侧身西望常咨嗟!", - "type": "七言乐府", - "author": "李白", - "title": "蜀道难" - }, - { - "id": 80, - "contents": "长相思,在长安。\n络纬秋啼金井阑,微霜凄凄簟色寒。\n孤灯不明思欲绝,卷帷望月空长叹。\n美人如花隔云端。\n上有青冥之长天,下有渌水之波澜。\n天长路远魂飞苦,梦魂不到关山难。\n长相思,摧心肝!", - "type": "七言乐府", - "author": "李白", - "title": "长相思二首之一" - }, - { - "id": 81, - "contents": "日色已尽花含烟,月明欲素愁不眠。\n赵瑟初停凤凰柱,蜀琴欲奏鸳鸯弦。\n此曲有意无人传,愿随春风寄燕然。\n忆君迢迢隔青天。\n昔日横波目,今成流泪泉。\n不信妾肠断,归来看取明镜前。", - "type": "七言乐府", - "author": "李白", - "title": "长相思二首之二" - }, - { - "id": 82, - "contents": "金樽清酒斗十千,玉盘珍羞值万钱。\n停杯投箸不能食,拔剑四顾心茫然。\n欲渡黄河冰塞川,将登太行雪满山。\n闲来垂钓碧溪上,忽复乘舟梦日边。\n行路难,行路难!多歧路,今安在?\n长风破浪会有时,直挂云帆济沧海。", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之一" - }, - { - "id": 83, - "contents": "大道如青天,我独不得出。\n羞逐长安社中儿,赤鸡白狗赌梨栗。\n弹剑作歌奏苦声,曳裾王门不称情。\n淮阴市井笑韩信,汉朝公卿忌贾生。\n君不见,昔时燕家重郭隗,拥彗折节无嫌猜\n剧辛乐毅感恩分,输肝剖胆效英才。\n昭王白骨萦蔓草,谁人更扫黄金台?\n行路难,归去来!", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之二" - }, - { - "id": 84, - "contents": "有耳莫洗颍川水,有口莫食首阳蕨。\n含光混世贵无名,何用孤高比云月?\n吾观自古贤达人,功成不退皆殒身。\n子胥既弃吴江上,屈原终投湘水滨。\n陆机雄才岂自保?李斯税驾苦不早。\n华亭鹤唳讵可闻,上蔡苍鹰何足道!\n君不见,吴中张翰称达生,秋风忽忆江东行。\n且乐生前一杯酒,何须身后千载名!", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之三" - }, - { - "id": 85, - "contents": "君不见,黄河之水天上来,奔流到海不复回。\n君不见,高堂明镜悲白发,朝如青丝暮成雪。\n人生得意须尽欢,莫使金樽空对月!\n天生我材必有用,千金散尽还复来。\n烹羊宰牛且为乐,会须一饮三百杯!\n岑夫子,丹丘生,将进酒,君莫停!\n与君歌一曲,请君为我侧耳听!\n钟鼓馔玉不足贵,但愿长醉不愿醒!\n古来圣贤皆寂寞,惟有饮者留其名!\n陈王昔时宴平乐,斗酒十千恣欢谑。\n主人何为言少钱?径须沽取对君酌。\n五花马,千金裘,呼儿将出换美酒,与尔同消万古愁!", - "type": "七言乐府", - "author": "李白", - "title": "将进酒" - }, - { - "id": 86, - "contents": "车辚辚,马萧萧,行人弓箭各在腰。\n耶娘妻子走相送,尘埃不见咸阳桥。\n牵衣顿足拦道哭,哭声直上干云霄!\n道旁过者问行人,行人但云点行频。\n或从十五北防河,便至四十西营田。\n去时里正与裹头,归来头白还戍边!\n边亭流血成海水,武皇开边意未已。\n君不闻,汉家山东二百州,千村万落生荆杞!\n纵有健妇把锄犁,禾生陇亩无东西。\n况复秦兵耐苦战,被驱不异犬与鸡。\n长者虽有问,役夫敢申恨?\n且如今年冬,未休关西卒。\n县官急索租,租税从何出?\n信知生男恶,反是生女好。\n生女犹得嫁比邻,生男埋没随百草!\n君不见,青海头,古来白骨无人收。\n新鬼烦冤旧鬼哭,天阴雨湿声啾啾!", - "type": "七言乐府", - "author": "杜甫", - "title": "兵车行" - }, - { - "id": 87, - "contents": "三月三日天气新,长安水边多丽人。\n态浓意远淑且真,肌理细腻骨肉匀。\n绣罗衣裳照暮春,蹙金孔雀银麒麟。\n头上何所有?翠微盍叶垂鬓唇。\n背后何所见?珠压腰[衤及]稳称身。\n就中云幕椒房亲,赐名大国虢与秦。\n紫驼之峰出翠釜,水精之盘行素鳞。\n犀箸餍饫久未下,鸾刀缕切空纷纶。\n黄门飞[革空]不动尘,御厨络绎送八珍。\n箫鼓哀吟感鬼神,宾从杂沓实要津。\n后来鞍马何逡巡,当轩下马入锦茵。\n杨花雪落覆白苹,青鸟飞去衔红巾。\n炙手可热势绝伦,慎莫近前丞相嗔!", - "type": "七言乐府", - "author": "杜甫", - "title": "丽人行" - }, - { - "id": 88, - "contents": "少陵野老吞生哭,春日潜行曲江曲。\n江头宫殿锁千门,细柳新蒲为谁绿?\n忆昔霓旌下南苑,苑中景物生颜色。\n昭阳殿里第一人,同辇随君侍君侧。\n辇前才人带弓箭,白马嚼啮黄金勒。\n翻身向天仰射云,一箭正坠双飞翼。\n明眸皓齿今何在?血污游魂归不得!\n清渭东流剑阁深,去住彼此无消息。\n人生有情泪沾臆,江水江花岂终极?\n黄昏胡骑尘满城,欲往城南望城北。", - "type": "七言乐府", - "author": "杜甫", - "title": "哀江头" - }, - { - "id": 89, - "contents": "长安城头头白乌,夜飞延秋门上呼。\n又向人家啄大屋,屋底达官走避胡。\n金鞭断折九马死,骨肉不待同驰驱。\n腰下宝[“决”换王旁]青珊瑚,可怜王孙泣路隅!\n问之不肯道姓名,但道困苦乞为奴。\n已经百日窜荆棘,身上无有完肌肤。\n高帝子孙尽隆准,龙种自与常人殊。\n豺狼在邑龙在野,王孙善保千金躯。\n不敢长语临交衢,且为王孙立斯须。\n昨夜东风吹血腥,东来橐驼满旧都。\n朔方健儿好身手,昔何勇锐今何愚!\n窃闻天子已传位,圣德北服南单于。\n花门□(“嫠”下女换刀)面请雪耻,慎勿出口他人狙!\n哀哉王孙慎勿疏,五陵佳气无时无。", - "type": "五言律诗", - "author": "杜甫", - "title": "哀王孙" - }, - { - "id": 90, - "contents": "夫子何为者,栖栖一代中。\n地犹鄹氏邑,宅即鲁王宫。\n叹凤嗟身否?伤麟怨道穷。\n今看两楹奠,当与梦时同。", - "type": "五言律诗", - "author": "唐玄宗", - "title": "经邹鲁祭孔子而叹之" - }, - { - "id": 91, - "contents": "海上生明月,天涯共此时。\n情人怨遥夜,竟夕起相思!\n灭烛怜光满,披衣觉露滋。\n不堪盈手赠,还寝梦佳期。", - "type": "五言律诗", - "author": "张九龄", - "title": "望月怀远" - }, - { - "id": 92, - "contents": "城阙辅三秦,风烟望五津。\n与君离别意,同是宦游人。\n海内存知己,天涯若比邻。\n无为在歧路,儿女共沾巾。", - "type": "五言律诗", - "author": "王勃", - "title": "送杜少府之任蜀州" - }, - { - "id": 93, - "contents": "余禁所禁垣西,是法厅事也。有古槐数株焉,虽生意可知,同殷仲文之古树,而听\n讼斯在,即周召伯之甘棠。每至夕照低阴,秋蝉疏引,发声幽息,有切尝闻;岂人\n心异於曩时,将虫响悲於前听?嗟乎!声以动容,德以象贤,故洁其身也,禀君子\n达人之高行;蜕其皮也,有仙都羽化之灵姿。候时而来,顺阴阳之数;应节为变,\n审藏用之机。有目斯开,不以道昏而昧其视;有翼自薄,不以俗厚而易其真。吟乔\n树之微风,韵资天纵;饮高秋之坠露,清畏人知。仆失路艰虞,遭时徽[纟墨],\n不哀伤而自怨,未摇落而先衰。闻蟪蛄之流声,悟平反之已奏;见螳螂之抱影,怯\n危机之未安。感而缀诗,贻诸知己。庶情沿物应,哀弱羽之飘零;道寄人知,悯馀\n声之寂寞。非谓文墨,取代幽忧云尔。\n西路蝉声唱,南冠客思侵。\n那堪玄鬓影,来对白头吟!\n露重飞难进,风多响易沉。\n无人信高洁,谁为表予心?", - "type": "五言律诗", - "author": "骆宾王", - "title": "在狱咏蝉并序" - }, - { - "id": 94, - "contents": "独有宦游人,偏惊物候新。\n云霞出海曙,梅柳渡江春。\n淑气催黄鸟,晴光转绿苹。\n忽闻歌古调,归思欲沾巾。", - "type": "五言律诗", - "author": "杜审言", - "title": "和晋陵路丞早春游望" - }, - { - "id": 95, - "contents": "闻道黄龙戍,频年不解兵。\n可怜闺里月,长在汉家营。\n少妇今春意,良人昨夜情。\n谁能将旗鼓,一为取龙城?", - "type": "五言律诗", - "author": "沈全期", - "title": "杂诗" - }, - { - "id": 96, - "contents": "阳月南飞雁,传闻至此回。\n我行殊未已,何日复归来?\n江静潮初落,林昏瘴不开。\n明朝望乡处,应见陇头梅。", - "type": "五言律诗", - "author": "宋之问", - "title": "题大庾岭北驿" - }, - { - "id": 97, - "contents": "客路青山外,行舟绿水前。\n潮平两岸阔,风正一帆悬。\n海日生残夜,江春入旧年。\n乡书何处达?归雁洛阳边。", - "type": "五言律诗", - "author": "王湾", - "title": "次北固山下" - }, - { - "id": 98, - "contents": "清晨入古寺,初日照高林。\n曲径通幽处,禅房花木深。\n山光悦鸟性,潭影空人心。\n万籁此俱寂,惟馀钟磬音。", - "type": "五言律诗", - "author": "常建", - "title": "题破山寺后禅院" - }, - { - "id": 99, - "contents": "联步趋丹陛,分曹限紫微。\n晓随天仗入,暮惹御香归。\n白发悲花落,青云羡鸟飞。\n圣朝无阙事,自觉谏书稀。", - "type": "五言律诗", - "author": "岑参", - "title": "寄左省杜拾遗" - }, - { - "id": 100, - "contents": "吾爱孟夫子,风流天下闻。\n红颜弃轩冕,白首卧松云。\n醉月频中圣,迷花不事君。\n高山安可仰,徒此挹清芬。", - "type": "五言律诗", - "author": "李白", - "title": "赠孟浩然" - }, - { - "id": 101, - "contents": "渡远荆门外,来从楚国游。\n山随平野尽,江入大荒流。\n月下飞天镜,云生结海楼。\n仍怜故乡水,万里送行舟。", - "type": "五言律诗", - "author": "李白", - "title": "渡荆门送别" - }, - { - "id": 102, - "contents": "青山横北郭,白水绕东城。\n此地一为别,孤蓬万里征。\n浮云游子意,落日故人情。\n挥手自兹去,萧萧班马鸣。", - "type": "五言律诗", - "author": "李白", - "title": "送友人" - }, - { - "id": 103, - "contents": "蜀僧抱绿绮,西下峨眉峰。\n为我一挥手,如听万壑松。\n客心洗流水,馀响入霜钟。\n不觉碧山暮,秋云暗几重。", - "type": "五言律诗", - "author": "李白", - "title": "听蜀僧浚弹琴" - }, - { - "id": 104, - "contents": "牛渚西江夜,青天无片云。\n登舟望秋月,空忆谢将军。\n余亦能高咏,斯人不可闻。\n明朝挂帆席,枫叶落纷纷。", - "type": "五言律诗", - "author": "李白", - "title": "夜泊牛渚怀古" - }, - { - "id": 105, - "contents": "今夜[鹿阝]州月,闺中只独看。\n遥怜小儿女,未解忆长安。\n香雾云鬟湿,清辉玉臂寒。\n何时倚虚幌,双照泪痕干?", - "type": "五言律诗", - "author": "杜甫", - "title": "月夜" - }, - { - "id": 106, - "contents": "国破山河在,城春草木深。\n感时花溅泪,恨别鸟惊心。\n烽火连三月,家书抵万金。\n白头搔更短,浑欲不胜簪。", - "type": "五言律诗", - "author": "杜甫", - "title": "春望" - }, - { - "id": 107, - "contents": "花隐掖垣暮,啾啾栖鸟过。\n星临万户动,月傍九霄多。\n不寝听金钥,因风想玉珂。\n明朝有封事,数问夜如何?", - "type": "五言律诗", - "author": "杜甫", - "title": "春宿左省" - }, - { - "id": 108, - "contents": "此道昔归顺,西郊胡正繁。\n至今残破胆,应有未招魂。\n近得归京邑,移官岂至尊?\n无才日衰老,驻马望千门。", - "type": "五言律诗", - "author": "杜甫", - "title": "至德二载甫自京金光门出,问道归凤翔。乾元初从左拾遗移华州掾。与亲故别,因出此门。有悲往事。" - }, - { - "id": 109, - "contents": "戍鼓断人行,秋边一雁声。\n露从今夜白,月是故乡明。\n有弟皆分散,无家问死生。\n寄书长不达,况乃未休兵。", - "type": "五言律诗", - "author": "杜甫", - "title": "月夜忆舍弟" - }, - { - "id": 110, - "contents": "凉风起天末,君子意如何?\n鸿雁几时到,江湖秋水多。\n文章憎命达,魑魅喜人过。\n应共冤魂语,投诗赠汨罗。", - "type": "五言律诗", - "author": "杜甫", - "title": "天末怀李白" - }, - { - "id": 111, - "contents": "远送从此别,青山空复情。\n几时杯重把,昨夜月同行。\n列郡讴歌惜,三朝出入荣。\n将村独归处,寂寞养残生。", - "type": "五言律诗", - "author": "杜甫", - "title": "奉济驿重送严公四韵" - }, - { - "id": 112, - "contents": "他乡复行役,驻马别孤坟。\n近泪无干土,低空有断云。\n对棋陪谢傅,把剑觅徐君。\n唯见林花落,莺啼送客闻。", - "type": "五言律诗", - "author": "杜甫", - "title": "别房太尉墓" - }, - { - "id": 113, - "contents": "细草微风岸,危樯独夜舟。\n星垂平野阔,月涌大江流。\n名岂文章著?官应老病休。\n飘飘何所似,天地一沙鸥。", - "type": "五言律诗", - "author": "杜甫", - "title": "旅夜书怀" - }, - { - "id": 114, - "contents": "昔闻洞庭水,今上岳阳楼。\n吴楚东南坼,乾坤日夜浮。\n亲朋无一字,老病有孤舟。\n戎马关山北,凭轩涕泗流。", - "type": "五言律诗", - "author": "杜甫", - "title": "登岳阳楼" - }, - { - "id": 115, - "contents": "寒山转苍翠,秋水日潺[氵爰]。\n倚杖柴门外,临风听暮蝉。\n渡头馀落日,墟里上孤烟。\n复值接舆醉,狂歌五柳前。", - "type": "五言律诗", - "author": "王维", - "title": "辋川闲居赠裴秀才迪" - }, - { - "id": 116, - "contents": "空山新雨后,天气晚来秋。\n明月松间照,清泉石上流。\n竹喧归浣女,莲动下渔舟。\n随意春芳歇,王孙自可留。", - "type": "五言律诗", - "author": "王维", - "title": "山居秋暝" - }, - { - "id": 117, - "contents": "清川带长薄,车马去闲闲。\n流水如有意,暮禽相与还。\n荒城临古渡,落日满秋山。\n迢递嵩高下,归来且闭关。", - "type": "五言律诗", - "author": "王维", - "title": "归嵩山作" - }, - { - "id": 118, - "contents": "太乙近天都,连山接海隅。\n白云回望合,青霭入看无。\n分野中峰变,阴晴众壑殊。\n欲投人处宿,隔水问樵夫。", - "type": "五言律诗", - "author": "王维", - "title": "终南山" - }, - { - "id": 119, - "contents": "晚年惟好静,万事不关心。\n自顾无长策,空知返旧林。\n松风吹解带,山月照弹琴。\n君问穷通理,渔歌入浦深。", - "type": "五言律诗", - "author": "王维", - "title": "酬张少府" - }, - { - "id": 120, - "contents": "不知香积寺,数里入云峰。\n古木无人径,深山何处钟?\n泉声咽危石,日色冷青松。\n薄暮空潭曲,安禅制毒龙。", - "type": "五言律诗", - "author": "王维", - "title": "过香积寺" - }, - { - "id": 121, - "contents": "万壑树参天,千山响杜鹃。\n山中一夜雨,树杪百重泉。\n汉女输[木童]布,巴人讼芋田。\n文翁翻教授,不敢倚先贤。", - "type": "五言律诗", - "author": "王维", - "title": "送梓州李使君" - }, - { - "id": 122, - "contents": "楚塞三湘接,荆门九派通。\n江流天地外,山色有无中。\n郡邑浮前浦,波澜动远空。\n襄阳好风日,留醉与山翁。", - "type": "五言律诗", - "author": "王维", - "title": "汉江临眺" - }, - { - "id": 123, - "contents": "中岁颇好道,晚家南山陲。\n兴来美独往,胜事空自知。\n行到水穷处,坐看云起时。\n偶然值林叟,谈笑无还期。", - "type": "五言律诗", - "author": "王维", - "title": "终南别业" - }, - { - "id": 124, - "contents": "八月湖水平,涵虚混太清。\n气蒸云梦泽,波撼岳阳城。\n欲济无舟楫,端居耻圣明。\n坐观垂钓者,空有羡鱼情。", - "type": "五言律诗", - "author": "孟浩然", - "title": "望洞庭湖赠张丞相" - }, - { - "id": 125, - "contents": "人事有代谢,往来成古今。\n江山留胜迹,我辈复登临。\n水落鱼梁浅,天寒梦泽深。\n羊公碑字在,读罢泪沾襟。", - "type": "五言律诗", - "author": "孟浩然", - "title": "与诸子登岘山" - }, - { - "id": 126, - "contents": "林卧愁春尽,开轩览物华。\n忽逢青鸟使,邀入赤松家。\n丹灶初开火,仙桃正发花。\n童颜若可驻,何惜醉流霞!", - "type": "五言律诗", - "author": "孟浩然", - "title": "清明日宴梅道士房" - }, - { - "id": 127, - "contents": "北阙休上书,南山归敝庐。\n不才明主弃,多病故人疏。\n白发催年老,青阳逼岁除。\n永怀愁不寐,松月夜窗墟。", - "type": "五言律诗", - "author": "孟浩然", - "title": "岁暮归南山" - }, - { - "id": 128, - "contents": "故人具鸡黍,邀我至田家。\n绿树村边合,青山郭外斜。\n开轩面场圃,把酒话桑麻。\n待到重阳日,还来就菊花。", - "type": "五言律诗", - "author": "孟浩然", - "title": "过故人庄" - }, - { - "id": 129, - "contents": "一丘尝欲卧,三径苦无资。\n北土非吾愿,东林怀我师。\n黄金燃桂尽,壮志逐年衰。\n日夕凉风至,闻蝉但益悲。", - "type": "五言律诗", - "author": "孟浩然", - "title": "秦中感秋寄远上人" - }, - { - "id": 130, - "contents": "山暝听猿愁,沧江急夜流。\n风鸣两岸叶,月照一孤舟。\n建德非吾土,维扬忆旧游。\n还将两行泪,遥寄海西头。", - "type": "五言律诗", - "author": "孟浩然", - "title": "宿桐庐江寄广陵旧游" - }, - { - "id": 131, - "contents": "寂寂竟何待,朝朝空自归。\n欲寻芳草去,惜与故人违。\n当路谁相假,知音世所稀。\n只应守寂寞,还掩故园扉。", - "type": "五言律诗", - "author": "孟浩然", - "title": "留别王侍御维" - }, - { - "id": 132, - "contents": "木落雁南渡,北风江上寒。\n我家襄水曲,遥隔楚云端。\n乡泪客中尽,孤帆天际看。\n迷津欲有问,平海夕漫漫。", - "type": "五言律诗", - "author": "孟浩然", - "title": "早寒江上有怀" - }, - { - "id": 133, - "contents": "古台摇落后,秋日望乡心。\n野寺人来少,云峰水隔深。\n夕阳依旧垒,寒磬满空林。\n惆怅南朝事,长江独至今。", - "type": "五言律诗", - "author": "刘长卿", - "title": "秋日登吴公台上寺远眺" - }, - { - "id": 134, - "contents": "流落征南将,曾驱十万师。\n罢归无旧业,老去恋明时。\n独立三边静,轻生一剑知。\n茫茫江汉上,日暮复何之。", - "type": "五言律诗", - "author": "刘常卿", - "title": "送李中丞归汉阳别业" - }, - { - "id": 135, - "contents": "望君烟水阔,挥手泪沾巾。\n飞鸟没何处,青山空向人。\n长江一帆远,落日五湖春。\n谁见汀洲上,相思愁白苹?", - "type": "五言律诗", - "author": "刘长卿", - "title": "饯别王十一南游" - }, - { - "id": 136, - "contents": "一路经行处,莓苔见履痕。\n白云依静渚,春草闭闲门。\n过雨看松色,随山到水源。\n溪花与禅意,相对亦忘言。", - "type": "五言律诗", - "author": "刘长卿", - "title": "寻南溪常山道人隐居" - }, - { - "id": 137, - "contents": "乡心新岁切,天畔独潸然。\n老至居人下,春归在客先。\n岭猿同旦暮,江柳共风烟。\n已似长沙傅,从今又几年?", - "type": "五言律诗", - "author": "刘长卿", - "title": "新年作" - }, - { - "id": 138, - "contents": "上国随缘住,来途若梦行。\n浮天沧海远,去世法舟轻。\n水月通禅寂,鱼龙听梵声。\n惟怜一灯影,万里眼中明。", - "type": "五言律诗", - "author": "钱起", - "title": "送僧归日本" - }, - { - "id": 139, - "contents": "泉壑带茅茨,云霞生薜帷。\n竹怜新雨后,山爱夕阳时。\n闲鹭栖常早,秋花落更迟。\n家童扫萝径,昨与故人期。", - "type": "五言律诗", - "author": "钱起", - "title": "谷口书斋寄杨补阙" - }, - { - "id": 140, - "contents": "江汉曾为客,相逢每醉还。\n浮云一别后,流水十年间。\n欢笑情如旧,萧疏鬓已斑。\n何因北归去,淮上对秋山。", - "type": "五言律诗", - "author": "韦应物", - "title": "淮上喜会梁川故人" - }, - { - "id": 141, - "contents": "楚江微雨里,建业暮钟时。\n漠漠帆来重,冥冥鸟去迟。\n海门深不见,浦树远含滋。\n相送情无限,沾襟比散丝。", - "type": "五言律诗", - "author": "韦应物", - "title": "赋得暮雨送李胄" - }, - { - "id": 142, - "contents": "长簟迎风早,空城澹月华。\n星河秋一雁,砧杵夜千家。\n节候看应晚,心期卧亦赊。\n向来吟秀句,不觉已鸣鸦。", - "type": "五言律诗", - "author": "韩□(“雄”右半换“羽”)", - "title": "酬程延秋夜即事见赠" - }, - { - "id": 143, - "contents": "道由白云尽,春与青溪长。\n时有落花至,远隋流水香。\n闲门向山路,深柳读书堂。\n幽映每白日,清辉照衣裳。", - "type": "五言律诗", - "author": "刘脊虚", - "title": "阙题" - }, - { - "id": 144, - "contents": "天秋月又满,城阙夜千重。\n还作江南会,翻疑梦里逢。\n风枝惊暗鹊,露草覆寒虫。\n羁旅长堪醉,相留畏晓钟。", - "type": "五言律诗", - "author": "戴叔伦", - "title": "江乡故人偶集客舍" - }, - { - "id": 145, - "contents": "故关衰草遍,离别正堪悲!\n路出寒云外,人归暮雪时。\n少孤为客早,多难识君迟。\n掩泪空相向,风尘何处期?", - "type": "五言律诗", - "author": "卢纶", - "title": "李端公" - }, - { - "id": 146, - "contents": "十年离乱后,长大一相逢。\n问姓惊初见,称名忆旧容。\n别来沧海事,语罢暮天钟。\n明日巴陵道,秋山又几重。", - "type": "五言律诗", - "author": "李益", - "title": "喜见外弟又言别" - }, - { - "id": 147, - "contents": "故人江海别,几度隔山川。\n乍见翻疑梦,相悲各问年。\n孤灯寒照雨,深竹暗浮烟。\n更有明朝恨,离杯惜共传。", - "type": "五言律诗", - "author": "司空曙", - "title": "云阳馆与韩绅宿别" - }, - { - "id": 148, - "contents": "静夜四无邻,荒居旧业贫。\n雨中黄叶树,灯下白头人。\n以我独沉久,愧君相访频。\n平生自有分,况是蔡家亲!", - "type": "五言律诗", - "author": "司空曙", - "title": "喜外弟卢纶见宿" - }, - { - "id": 149, - "contents": "世乱同南去,时清独北还。\n他乡生白发,旧国见青山。\n晓月过残垒,繁星宿故关。\n寒禽与衰草,处处伴愁颜。", - "type": "五言律诗", - "author": "司空曙", - "title": "贼平后送人北归" - }, - { - "id": 150, - "contents": "天地英雄气,千秋尚凛然!\n势分三足鼎,业复五铢钱。\n得相能开国,生儿不象贤。\n凄凉蜀故妓,来舞魏宫前。", - "type": "五言律诗", - "author": "刘禹锡", - "title": "蜀先主庙" - }, - { - "id": 151, - "contents": "前年伐月支,城下没全师。\n蕃汉断消息,死生长别离。\n无人收废帐,归马识残旗。\n欲祭疑君在,天涯哭此时。", - "type": "五言律诗", - "author": "张籍", - "title": "没蕃故人" - }, - { - "id": 152, - "contents": "离离原上草,一岁一枯荣。\n野火烧不尽,春风吹又生。\n远芳侵古道,晴翠接荒城。\n又送王孙去,萋萋满别情。", - "type": "五言律诗", - "author": "白居易", - "title": "赋得古原草送别" - }, - { - "id": 153, - "contents": "旅馆无良伴,凝情自悄然。\n寒灯思旧事,断雁警愁眠。\n远梦归侵晓,家书到隔年。\n沧江好烟月,门系钓鱼船。", - "type": "五言律诗", - "author": "杜牧", - "title": "旅宿" - }, - { - "id": 154, - "contents": "红叶晚萧萧,长亭酒一瓢。\n残云归太华,疏雨过中条。\n树色随山迥,河声入海遥。\n帝乡明日到,犹自梦渔樵。", - "type": "五言律诗", - "author": "许浑", - "title": "秋日赴阙题潼关驿楼" - }, - { - "id": 155, - "contents": "遥夜泛清瑟,西风生翠萝。\n残萤栖玉露,早雁拂银河。\n高树晓还密,远山晴更多。\n淮南一叶下,自觉老烟波。", - "type": "五言律诗", - "author": "许浑", - "title": "早秋" - }, - { - "id": 156, - "contents": "本以高难饱,徒劳恨费声。\n五更疏欲断,一树碧无情。\n薄宦梗犹泛,故园芜已平。\n烦君最相警,我亦举家清。", - "type": "五言律诗", - "author": "李商隐", - "title": "蝉" - }, - { - "id": 157, - "contents": "凄凉宝剑篇,羁泊欲穷年。\n黄叶仍风雨,青楼自管弦。\n新知遭薄俗,旧好隔良缘。\n心断新丰酒,销愁斗几千。", - "type": "五言律诗", - "author": "李商隐", - "title": "风雨" - }, - { - "id": 158, - "contents": "高阁客竟去,小园花乱飞。\n参差连曲陌,迢递送斜晖。\n肠断未忍扫,眼穿仍欲归。\n芳心向春尽,所得是沾衣。", - "type": "五言律诗", - "author": "李商隐", - "title": "落花" - }, - { - "id": 159, - "contents": "客去波平槛,蝉休露满枝。\n永怀当此节,倚立自移时。\n北斗兼春远,南陵寓使迟。\n天涯占梦数,疑误有新知。", - "type": "五言律诗", - "author": "李商隐", - "title": "凉思" - }, - { - "id": 160, - "contents": "残阳西入崦,茅屋访孤僧。\n落叶人何在?寒云路几层?\n独敲初夜磬,闲倚一枝藤。\n世界微尘里,吾宁爱与憎。", - "type": "五言律诗", - "author": "李商隐", - "title": "北青萝" - }, - { - "id": 161, - "contents": "荒戍落黄叶,浩然离故关。\n高风汉阳渡,初日郢门山。\n江上几人在?天涯孤棹还。\n何当重相见,樽酒慰离颜?", - "type": "五言律诗", - "author": "温庭筠", - "title": "送人东游" - }, - { - "id": 162, - "contents": "灞原风雨定,晚见雁行频。\n落叶他乡树,寒灯独夜人。\n空园白露滴,孤壁野僧邻。\n寄卧郊扉久,何年致此身?", - "type": "五言律诗", - "author": "马戴", - "title": "灞上秋居" - }, - { - "id": 163, - "contents": "露气寒光集,微阳下楚丘。\n猿啼洞庭树,人在木兰舟。\n广泽生明月,苍山夹乱流。\n云中君不见,竟夕自悲秋。", - "type": "五言律诗", - "author": "马戴", - "title": "楚江怀古" - }, - { - "id": 164, - "contents": "调角断清秋,征人倚戍楼。\n春风对青冢,白日落梁州。\n大漠无兵阻,穷边有客游。\n蕃情似此水,长愿向南流。", - "type": "五言律诗", - "author": "张乔", - "title": "书边事" - }, - { - "id": 165, - "contents": "迢递三巴路,羁危万里身。\n乱山残雪夜,孤独异乡春。\n渐与骨肉远,转於僮仆亲。\n那堪正飘泊,明日岁华新。", - "type": "五言律诗", - "author": "崔涂", - "title": "巴山道中除夜有怀" - }, - { - "id": 166, - "contents": "几行归塞尽,片影独何之?\n暮雨相呼失,寒塘欲下迟。\n渚云低暗渡,关月冷相随。\n未必逢[矢曾]缴,孤飞自可疑。", - "type": "五言律诗", - "author": "崔涂", - "title": "孤雁" - }, - { - "id": 167, - "contents": "早被婵娟误,欲妆临镜慵。\n承恩不在貌,教妾若为容。\n风暖鸟声碎,日高花影重。\n年年越溪女,相忆采芙蓉。", - "type": "五言律诗", - "author": "杜荀鹤", - "title": "春宫怨" - }, - { - "id": 168, - "contents": "清瑟怨遥夜,绕弦风雨哀。\n孤灯闻楚角,残月下章台。\n芳草已云暮,故人殊未来。\n乡书不可寄,秋雁又南回。", - "type": "五言律诗", - "author": "韦庄", - "title": "章台夜思" - }, - { - "id": 169, - "contents": "移家虽带郭,野径入桑麻。\n近种篱边菊,秋来未著花。\n扣门无犬吠,欲去问西家。\n报到山中去,归来每日斜。", - "type": "五言律诗", - "author": "僧皎然", - "title": "寻陆鸿渐不遇" - }, - { - "id": 170, - "contents": "昔人已乘黄鹤去,此地空馀黄鹤楼。\n黄鹤一去不复返,白云千载空悠悠。\n晴川历历汉阳树,芳草萋萋鹦鹉洲。\n日暮乡关何处是,烟波江上使人愁。", - "type": "七言律诗", - "author": "崔颢", - "title": "黄鹤楼" - }, - { - "id": 171, - "contents": "迢□(“绕”换山旁)太华俯咸京,天外三峰削不成。\n武帝祠前云欲散,仙人掌上雨初晴。\n河山北枕秦关险,驿树西连汉[田寺]平。\n借问路傍名利客,无如此处学长生。", - "type": "七言律诗", - "author": "崔颢", - "title": "行经华阴" - }, - { - "id": 172, - "contents": "燕台一去客心惊,箫鼓喧喧汉将营。\n万里寒光生积雪,三边曙色动危旌。\n沙场烽火侵胡月,海畔云山拥蓟城。\n少小虽非投笔吏,论功还欲请长缨。", - "type": "七言律诗", - "author": "祖咏", - "title": "望蓟门" - }, - { - "id": 173, - "contents": "朝闻游子唱骊歌,昨夜微霜初度河。\n鸿雁不堪愁里听,云山况是客中过。\n关城树色催寒近,御苑砧声向晚多。\n莫见长安行乐处,空令岁月易蹉跎。", - "type": "七言律诗", - "author": "李颀", - "title": "送魏万之京" - }, - { - "id": 174, - "contents": "汉文皇帝有高台,此日登临曙色开。\n三晋云山皆北向,二陵风雨自东来。\n关门令尹谁能识?河上仙翁去不回。\n且欲竟寻彭泽宰,陶然共醉菊花杯。", - "type": "七言律诗", - "author": "崔曙", - "title": "九日登望仙台呈刘明府" - }, - { - "id": 176, - "contents": "嗟君此别意何如?驻马衔杯问谪居。\n巫峡啼猿数行泪,衡阳归雁几封书。\n青枫江上秋帆远,白帝城边古木疏。\n圣代即今多雨露,暂时分手莫踌躇。", - "type": "七言律诗", - "author": "高适", - "title": "送李少府贬峡中王少府贬长沙" - }, - { - "id": 177, - "contents": "鸡鸣紫陌曙光寒,莺啭皇州春色阑。\n金阙晓钟开万户,玉阶仙仗拥千官。\n花迎剑佩星初落,柳拂旌旗露未干。\n独有凤凰池上客,阳春一曲和皆难。", - "type": "七言律诗", - "author": "岑参", - "title": "奉和中书舍人贾至早朝大明宫" - }, - { - "id": 178, - "contents": "绛帻鸡人送晓筹,尚衣方进翠云裘。\n九天阊阖开宫殿,万国衣冠拜冕旒。\n日色才临仙掌动,香烟欲傍衮龙浮。\n朝罢须裁五色诏,佩声归向凤池头。", - "type": "七言律诗", - "author": "王维", - "title": "和贾舍人早朝大明宫之作" - }, - { - "id": 179, - "contents": "渭水自萦秦塞曲,黄山旧绕汉宫斜。\n銮舆迥出千门柳,阁道回看上苑花。\n云里帝城双凤阙,雨中春树万人家。\n为乘阳气行时令,不是宸游玩物华。", - "type": "七言律诗", - "author": "王维", - "title": "奉和圣制从蓬莱向兴庆阁道中留春雨中春望之作应制" - }, - { - "id": 180, - "contents": "积雨空林烟火迟,蒸藜炊黍饷东□(“淄”去三点水加草头)。\n漠漠水田飞白鹭,阴阴夏木啭黄鹂。\n山中习静观朝槿,松下清斋折露葵。\n野老与人争席罢,海鸥何事更相疑。", - "type": "七言律诗", - "author": "王维", - "title": "积雨辋川庄作" - }, - { - "id": 181, - "contents": "洞门高阁霭馀辉,桃李阴阴柳絮飞。\n禁里疏钟官舍晚,省中啼鸟吏人稀。\n晨摇玉佩趋金殿,夕奉天书拜琐闱。\n强欲从君无那老,将因卧病解朝衣。", - "type": "七言律诗", - "author": "王维", - "title": "酬郭给事" - }, - { - "id": 182, - "contents": "丞相祠堂何处寻?锦官城外柏森森。\n映阶碧草自春色,隔叶黄鹂空好音。\n三顾频烦天下计,两朝开济老臣心。\n出师未捷身先死,长使英雄泪满襟!", - "type": "七言律诗", - "author": "杜甫", - "title": "蜀相" - }, - { - "id": 183, - "contents": "舍南舍北皆春水,但见群鸥日日来。\n花径不曾缘客扫,蓬门今始为君开。\n盘飧市远无兼味,樽酒家贫只旧醅。\n肯与邻翁相对饮,隔篱呼取尽馀杯!", - "type": "七言律诗", - "author": "杜甫", - "title": "客至" - }, - { - "id": 184, - "contents": "西山白雪三城戍,南浦清江万里桥。\n海内风尘诸弟隔,天涯涕泪一身遥。\n唯将迟暮供多病,未有涓埃答圣朝。\n跨马出郊时极目,不堪人事日萧条!", - "type": "七言律诗", - "author": "杜甫", - "title": "野望" - }, - { - "id": 185, - "contents": "剑外忽传收蓟北,初闻涕泪满衣裳。\n却看妻子愁何在,漫卷诗书喜欲狂。\n白日放歌须纵酒,青春作伴好还乡!\n即从巴峡穿巫峡,便下襄阳向洛阳。", - "type": "七言律诗", - "author": "杜甫", - "title": "闻官军收河南河北" - }, - { - "id": 186, - "contents": "风急天高猿啸哀,渚清沙白鸟飞回。\n无边落木萧萧下,不尽长江滚滚来。\n万里悲秋常作客,百年多病独登台。\n艰难苦恨繁霜鬓,潦倒新停浊酒杯。", - "type": "七言律诗", - "author": "杜甫", - "title": "登高" - }, - { - "id": 187, - "contents": "花近高楼伤客心,万方多难此登临。\n锦江春色来天地,玉垒浮云变古今。\n北极朝庭终不改,西山寇盗莫相侵!\n可怜后主还祠庙,日暮聊为梁父吟。", - "type": "七言律诗", - "author": "杜甫", - "title": "登楼" - }, - { - "id": 188, - "contents": "清秋幕府井梧寒,独宿江城蜡炬残。\n永夜角声悲自语,中天月色好谁看?\n风尘荏苒音书绝,关塞萧条行陆难。\n已忍伶俜十年事,强移栖息一枝安。", - "type": "七言律诗", - "author": "杜甫", - "title": "宿府" - }, - { - "id": 189, - "contents": "岁暮阴阳催短景,天涯霜雪霁寒霄。\n五更鼓角声悲壮,三峡星河影动摇。\n野哭千家闻战伐,夷歌数处起渔樵。\n卧龙跃马终黄土,人事音书漫寂寥。", - "type": "七言律诗", - "author": "杜甫", - "title": "阁夜" - }, - { - "id": 190, - "contents": "支离东北风尘际,漂泊西南天地间。\n三峡楼台淹日月,五溪衣服共云山。\n羯胡事主终无赖,词客哀时且未还。\n庾信平生最萧瑟,暮年诗赋动江关。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之一" - }, - { - "id": 191, - "contents": "摇落深知宋玉悲,风流儒雅亦吾师。\n怅望千秋一洒泪,萧条异代不同时。\n江山故宅空文藻,云雨荒台岂梦思!\n最是楚宫俱泯灭,舟人指点到今疑。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之二" - }, - { - "id": 192, - "contents": "群山万壑赴荆门,生长明妃尚有村。\n一去紫台连朔漠,独留青冢向黄昏。\n画图省识春风面,环佩空归月下魂。\n千载琵琶作胡语,分明怨恨曲中论。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之三" - }, - { - "id": 193, - "contents": "蜀主征吴幸三峡,崩年亦在永安宫。\n翠华想像空山里,玉殿虚无野寺中。\n古庙杉松巢水鹤,岁时伏腊走村翁。\n武侯祠屋常邻近,一体君臣祭祀同。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之四" - }, - { - "id": 194, - "contents": "诸葛大名垂宇宙,宗臣遗像肃清高。\n三分割据纡筹策,万古云霄一羽毛。\n伯仲之间见伊吕,指挥若定失萧曹。\n运移汉祚终难复,志决身歼军务劳。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之五" - }, - { - "id": 195, - "contents": "生涯岂料承优诏?世事空知学醉歌。\n江上月明胡雁过,淮南木落楚山多。\n寄身且喜沧洲近,顾影无如白发何!\n今日龙钟人共老,愧君犹遣慎风波。", - "type": "七言律诗", - "author": "刘长卿", - "title": "江州重别薛六柳八二员外" - }, - { - "id": 196, - "contents": "三年谪宦此栖迟,万古惟留楚客悲。\n秋草独寻人去后,寒林空见日斜时。\n汉文有道恩犹薄,湘水无情吊岂知?\n寂寂江山摇落处,怜君何事到天涯!", - "type": "七言律诗", - "author": "刘长卿", - "title": "长沙过贾谊宅" - }, - { - "id": 197, - "contents": "汀洲无浪复无烟,楚客相思益渺然。\n汉口夕阳斜渡鸟,洞庭秋水远连天。\n孤城背岭寒吹角,独戍临江夜泊船。\n贾谊上书忧汉室,长沙谪去古今怜。", - "type": "七言律诗", - "author": "刘长卿", - "title": "自夏口至鹦洲夕望岳阳寄源中丞" - }, - { - "id": 198, - "contents": "二月黄鹂飞上林,春城紫禁晓阴阴。\n长乐钟声花外尽,龙池柳色雨中深。\n阳和不散穷途恨,霄汉长怀捧日心。\n献赋十年犹未遇,羞将白发对华簪。", - "type": "七言律诗", - "author": "钱起", - "title": "赠阙下裴舍人" - }, - { - "id": 199, - "contents": "去年花里逢君别,今日花开又一年。\n世事茫茫难自料,春愁黯黯独成眠。\n身多疾病思田里,邑有流亡愧俸钱。\n闻道欲来相问讯,西楼望月几回圆?", - "type": "七言律诗", - "author": "韦应物", - "title": "寄李儋元锡" - }, - { - "id": 200, - "contents": "仙台初见五城楼,风物凄凄宿雨收。\n山色遥连秦树晚,砧声近报汉宫秋。\n疏松影落空坛静,细草香闲小洞幽。\n何用别寻方外去,人间亦自有丹丘!", - "type": "七言律诗", - "author": "韩□", - "title": "同题仙游观" - }, - { - "id": 201, - "contents": "莺啼燕语报新年,马邑龙堆路几千。\n家住层城邻汉苑,心随明月到胡天。\n机中锦字论长恨,楼上花枝笑独眠。\n为问天戎窦车骑,何时返旆勒燕然?", - "type": "七言律诗", - "author": "皇甫冉", - "title": "春思" - }, - { - "id": 202, - "contents": "云开远见汉阳城,犹是孤帆一日程。\n估客昼眠知浪静,舟人夜语觉潮生。\n三湘愁鬓逢秋色,万里归心对月明。\n旧业已随征战尽,更堪江上鼓鼙声。", - "type": "七言律诗", - "author": "卢纶", - "title": "晚次鄂州" - }, - { - "id": 203, - "contents": "城上高楼接大荒,海天愁思正茫茫。\n惊风乱[风占)芙蓉水,密雨斜侵薜荔墙。\n岭树重遮千里目,江流曲似九回肠。\n共来百越文身地,犹自音书滞一乡。", - "type": "七言律诗", - "author": "柳宗元", - "title": "登柳州城楼寄漳汀封连四州刺史" - }, - { - "id": 204, - "contents": "王浚楼船下益州,金陵王气黯然收。\n千寻铁锁沈江底,一片降幡出石头。\n人世几回伤往事?山形依旧枕寒流。\n从今四海为家日,故垒萧萧芦荻秋。", - "type": "七言律诗", - "author": "刘禹锡", - "title": "西塞山怀古" - }, - { - "id": 205, - "contents": "谢公最小偏怜女,自嫁黔娄百事乖。\n顾我无衣搜荩箧,泥他沽酒拔金钗。\n野蔬充膳甘长藿,落叶添薪仰古槐。\n今日俸钱过十万,与君营奠复营斋。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之一" - }, - { - "id": 206, - "contents": "昔日戏言身后事,今朝都到眼前来。\n衣裳已施行看尽,针线犹存未忍开。\n尚想旧情怜婢仆,也曾因梦送钱财。\n诚知此恨人人有,贫贱夫妻百事哀。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之二" - }, - { - "id": 207, - "contents": "闲坐悲君亦自悲,百年都是几多时?\n邓攸无子寻知命,潘岳悼亡犹费词。\n同穴□(上“穴”下“目”)冥何所望,他生缘会更难期。\n惟将终夜长开眼,报答平生未展眉。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之三" - }, - { - "id": 208, - "contents": "时难年荒世业空,弟兄羁旅各西东。\n田园寥落干戈后,骨肉流离道路中。\n吊影分为千里雁,辞根散作九秋蓬。\n共看明月应垂泪,一夜乡心五处同。", - "type": "七言律诗", - "author": "白居易", - "title": "望月有感" - }, - { - "id": 209, - "contents": "锦瑟无端五十弦,一弦一柱思华年。\n庄生晓梦迷蝴蝶,望帝春心托杜鹃。\n沧海月明珠有泪,蓝田日暖玉生烟。\n此情可待成追忆,只是当时已惘然。", - "type": "七言律诗", - "author": "李商隐", - "title": "锦瑟" - }, - { - "id": 210, - "contents": "昨夜星辰昨夜风,画楼西畔桂堂东。\n身无彩凤双飞翼,心有灵犀一点通。\n隔座送钩春酒暖,分曹射覆蜡灯红。\n嗟余听鼓应官去,走马兰台类转蓬。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题" - }, - { - "id": 211, - "contents": "紫泉宫殿锁烟霞,欲取芜城作帝家。\n玉玺不缘归日角,锦帆应是到天涯。\n於今腐草无萤火,终古垂杨有暮鸦。\n地下若逢陈后主,岂宜重问后庭花?", - "type": "七言律诗", - "author": "李商隐", - "title": "隋宫" - }, - { - "id": 212, - "contents": "来是空言去绝踪,月斜楼上五更钟。\n梦为远别啼难唤,书被催成墨未浓。\n蜡照半笼金翡翠,麝熏微度绣芙蓉。\n刘郎已恨蓬山远,更隔蓬山一万重。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之一" - }, - { - "id": 213, - "contents": "飒飒东风细雨来,芙蓉塘外有轻雷。\n金蟾啮锁烧香入,玉虎牵丝汲井回。\n贾氏窥帘韩掾少,宓妃留枕魏王才。\n春心莫共花争发,一寸相思一寸灰。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之二" - }, - { - "id": 214, - "contents": "猿鸟犹疑畏简书,风云常为护储胥。\n徒令上将挥神笔,终见降王走传车。\n管乐有才原不忝,关张无命欲何如。\n他年锦里经祠庙,梁父吟成恨有馀。", - "type": "七言律诗", - "author": "李商隐", - "title": "筹笔驿" - }, - { - "id": 215, - "contents": "相见时难别亦难,东风无力百花残。\n春蚕到死丝方尽,蜡炬成灰泪始干。\n晓镜但愁云鬓改,夜吟应觉月光寒。\n蓬莱此去无多路,青鸟殷勤为探看。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题" - }, - { - "id": 216, - "contents": "怅卧新春白袷衣,白门寥落意多违。\n红楼隔雨相望冷,珠箔飘灯独自归。\n远路应悲春[日宛]晚,残宵犹得梦依稀。\n玉[王当]缄札何由达?万里云罗一雁飞。", - "type": "七言律诗", - "author": "李商隐", - "title": "春雨" - }, - { - "id": 217, - "contents": "凤尾香罗薄几重,碧文圆顶夜深缝。\n扇裁月魄羞难掩,车走雷声语未通。\n曾是寂寥金烬暗,断无消息石榴红。\n斑骓只系垂杨岸,何处西南任好风?", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之一" - }, - { - "id": 218, - "contents": "重帷深下莫愁堂,卧后清宵细细长。\n神女生涯原是梦,小姑居处本无郎。\n风波不信菱枝弱,月露谁教桂叶香?\n直道相思了无益,未妨惆怅是清狂。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之二" - }, - { - "id": 219, - "contents": "澹然空水对斜晖,曲岛苍茫接翠微。\n波上马嘶看棹去,柳边人歇待船归。\n数丛沙草群鸥散,万顷江田一鹭飞。\n谁解乘舟寻范蠡,五湖烟水独忘机?", - "type": "七言律诗", - "author": "温庭筠", - "title": "利洲南渡" - }, - { - "id": 220, - "contents": "苏武魂销汉使前,古祠高树两茫然。\n云边雁断胡天月,陇上羊归塞草烟。\n回日楼台非甲帐,去时冠剑是丁年。\n茂陵不见封侯印,空向秋波哭逝川。", - "type": "七言律诗", - "author": "温庭筠", - "title": "苏武庙" - }, - { - "id": 221, - "contents": "十二楼中尽晓妆,望仙楼上望君王。\n锁衔金兽连环冷,水滴铜龙昼漏长。\n云髻罢梳还对镜,罗衣欲换更添香。\n遥窥正殿帘开处,袍裤宫人扫御床。", - "type": "七言律诗", - "author": "薛逢", - "title": "宫词" - }, - { - "id": 222, - "contents": "蓬门未识绮罗香,拟托良媒益自伤。\n谁爱风流高格调?共怜时世俭梳妆。\n敢将十指夸针巧,不把双眉斗画长。\n苦恨年年压金线,为他人作嫁衣裳。", - "type": "七言律诗", - "author": "秦韬玉", - "title": "贫女" - }, - { - "id": 223, - "contents": "卢家少妇郁金香,海燕双栖玳瑁梁。\n九月寒砧催木叶,十年征戍忆辽阳。\n白狼河北音书断,丹凤城南秋夜长。\n谁为含愁独不见,更教明月照流黄?", - "type": "七言律诗", - "author": "沈全期", - "title": "古意呈补阙乔知之" - }, - { - "id": 224, - "contents": "空山不见人,但闻人语响。\n返景入深林,复照青苔上。", - "type": "五言绝句", - "author": "王维", - "title": "鹿柴" - }, - { - "id": 225, - "contents": "独坐幽篁里,弹琴复长啸。\n深林人不知,明月来相照。", - "type": "五言绝句", - "author": "王维", - "title": "竹里馆" - }, - { - "id": 226, - "contents": "山中相送罢,日暮掩柴扉。\n春草明年绿,王孙归不归?", - "type": "五言绝句", - "author": "王维", - "title": "送别" - }, - { - "id": 227, - "contents": "红豆生南国,春来发几枝?\n愿君多采撷,此物最相思。", - "type": "五言绝句", - "author": "王维", - "title": "相思" - }, - { - "id": 228, - "contents": "君自故乡来,应知故乡事。\n来日绮窗前,寒梅著花未?", - "type": "五言绝句", - "author": "王维", - "title": "杂诗" - }, - { - "id": 229, - "contents": "归山深浅去,须尽丘壑美。\n莫学武陵人,暂游桃源里。", - "type": "五言绝句", - "author": "裴迪", - "title": "送崔九" - }, - { - "id": 230, - "contents": "终南阴岭秀,积雪浮云端。\n林表明霁色,城中增暮寒。", - "type": "五言绝句", - "author": "祖咏", - "title": "终南望馀雪" - }, - { - "id": 231, - "contents": "移舟泊烟渚,日暮客愁新。\n野旷天低树,江清月近人。", - "type": "五言绝句", - "author": "孟浩然", - "title": "宿建德江" - }, - { - "id": 232, - "contents": "春眠不觉晓,处处闻啼鸟。\n夜来风雨声,花落知多少?", - "type": "五言绝句", - "author": "孟浩然", - "title": "春晓" - }, - { - "id": 233, - "contents": "床前明月光,疑是地上霜。\n举头望明月,低头思故乡。", - "type": "五言绝句", - "author": "李白", - "title": "夜思" - }, - { - "id": 234, - "contents": "美人卷珠帘,深坐蹙蛾眉。\n但见泪痕湿,不知心恨谁?", - "type": "五言绝句", - "author": "李白", - "title": "怨情" - }, - { - "id": 235, - "contents": "功盖三分国,名成八阵图。\n江流石不转,遗恨失吞吴。", - "type": "五言绝句", - "author": "杜甫", - "title": "八阵图" - }, - { - "id": 236, - "contents": "白日依山尽,黄河入海流。\n欲穷千里目,更上一层楼。", - "type": "五言绝句", - "author": "王之涣", - "title": "登鹳雀楼" - }, - { - "id": 237, - "contents": "苍苍竹林寺,杳杳钟声晚。\n荷笠带斜阳,青山独归远。", - "type": "五言绝句", - "author": "刘长卿", - "title": "送灵澈" - }, - { - "id": 238, - "contents": "泠泠七弦上,静听松风寒。\n古调虽自爱,今人多不弹。", - "type": "五言绝句", - "author": "刘长卿", - "title": "弹琴" - }, - { - "id": 239, - "contents": "孤云将野鹤,岂向人间住!\n莫买沃洲山,时人已知处。", - "type": "五言绝句", - "author": "刘长卿", - "title": "送上人" - }, - { - "id": 240, - "contents": "怀君属秋夜,散步咏凉天。\n空山松子落,幽人应未眠。", - "type": "五言绝句", - "author": "韦应物", - "title": "秋夜寄邱员外" - }, - { - "id": 241, - "contents": "鸣筝金粟柱,素手玉房前。\n欲得周郎顾,时时误拂弦。", - "type": "五言绝句", - "author": "李端", - "title": "听筝" - }, - { - "id": 242, - "contents": "三日入厨下,洗手作羹汤。\n未谙姑食性,先遣小姑尝。", - "type": "五言绝句", - "author": "王建", - "title": "新嫁娘" - }, - { - "id": 243, - "contents": "昨夜裙带解,今朝[虫喜]子飞。\n铅华不可弃,莫是藁砧归。", - "type": "五言绝句", - "author": "权德舆", - "title": "玉台体" - }, - { - "id": 244, - "contents": "千山鸟飞绝,万径人踪灭。\n孤舟蓑笠翁,独钓寒江雪。", - "type": "五言绝句", - "author": "柳宗元", - "title": "江雪" - }, - { - "id": 245, - "contents": "寥落古行宫,宫花寂寞红。\n白头宫女在,闲坐说玄宗。", - "type": "五言绝句", - "author": "元稹", - "title": "行宫" - }, - { - "id": 246, - "contents": "绿蚁新醅酒,红泥小火炉。\n晚来天欲雪,能饮一杯无?", - "type": "五言绝句", - "author": "白居易", - "title": "问刘十九" - }, - { - "id": 247, - "contents": "故国三千里,深宫二十年。\n一声何满子,双泪落君前。", - "type": "五言绝句", - "author": "张祜", - "title": "何满子" - }, - { - "id": 248, - "contents": "向晚意不适,驱车登古原。\n夕阳无限好,只是近黄昏。", - "type": "五言绝句", - "author": "李商隐", - "title": "登乐游原" - }, - { - "id": 249, - "contents": "松下问童子,言师采药去。\n只在此山中,云深不知处。", - "type": "五言绝句", - "author": "贾岛", - "title": "寻隐者不遇" - }, - { - "id": 250, - "contents": "岭外音书绝,经冬复立春。\n近乡情更怯,不敢问来人。", - "type": "五言绝句", - "author": "李频", - "title": "渡汉江" - }, - { - "id": 251, - "contents": "打起黄莺儿,莫教枝上啼。\n啼时惊妾梦,不得到辽西。", - "type": "五言绝句", - "author": "金昌绪", - "title": "春怨" - }, - { - "id": 178, - "contents": "北斗七星高,哥舒夜带刀。\n至今窥牧马,不敢过临洮。", - "type": "七言律诗", - "author": "西鄙人", - "title": "哥舒歌" - }, - { - "id": 253, - "contents": "君家何处住,妾住在横塘。\n停船暂借问,或恐是同乡。", - "type": "五言绝句", - "author": "崔颢", - "title": "长干行二首之一" - }, - { - "id": 254, - "contents": "家临九江水,来去九江侧。\n同是长干人,生小不相识。", - "type": "五言绝句", - "author": "崔颢", - "title": "长干行二首之二" - }, - { - "id": 255, - "contents": "玉阶生白露,夜久侵罗袜。\n却下水晶帘,玲珑望秋月。", - "type": "五言绝句", - "author": "李白", - "title": "玉阶怨" - }, - { - "id": 256, - "contents": "鹫翎金仆姑,燕尾绣蝥弧。\n独立扬新令,千营共一呼。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之一" - }, - { - "id": 257, - "contents": "林暗草惊风,将军夜引弓。\n平明寻白羽,没在石棱中。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之二" - }, - { - "id": 258, - "contents": "月黑雁飞高,单于夜遁逃。\n欲将轻骑逐,大雪满弓刀。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之三" - }, - { - "id": 259, - "contents": "野幕蔽琼筵,羌戎贺劳旋。\n醉和金甲舞,雷鼓动山川。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之四" - }, - { - "id": 260, - "contents": "嫁得瞿塘贾,朝朝误妾期。\n早知潮有信,嫁与弄潮儿。", - "type": "五言绝句", - "author": "李益", - "title": "江南曲" - }, - { - "id": 261, - "contents": "少小离家老大回,乡音无改鬓毛衰。\n儿童相见不相识,笑问客从何处来?", - "type": "七言绝句", - "author": "贺知章", - "title": "回乡偶书" - }, - { - "id": 262, - "contents": "隐隐飞桥隔野烟,石矶西畔问渔船。\n桃花尽日随流水,洞在清溪何处边?", - "type": "七言绝句", - "author": "张旭", - "title": "桃花溪" - }, - { - "id": 263, - "contents": "独在异乡为异客,每逢佳节倍思亲。\n遥知兄弟登高处,遍插茱萸少一人。", - "type": "七言绝句", - "author": "王维", - "title": "九月九日忆山东兄弟" - }, - { - "id": 264, - "contents": "寒雨连江夜入吴,平明送客楚山孤。\n洛阳亲友如相问,一片冰心在玉壶。", - "type": "七言绝句", - "author": "王昌龄", - "title": "芙蓉楼送辛渐" - }, - { - "id": 265, - "contents": "闺中少妇不知愁,春日凝妆上翠楼。\n忽见陌头杨柳色,悔教夫婿觅封侯。", - "type": "七言绝句", - "author": "王昌龄", - "title": "闺怨" - }, - { - "id": 266, - "contents": "昨夜风开露井桃,未央前殿月轮高。\n平阳歌舞新承宠,帘外春寒赐锦袍。", - "type": "七言绝句", - "author": "王昌龄", - "title": "春宫曲" - }, - { - "id": 267, - "contents": "葡萄美酒夜光杯,欲饮琵琶马上催。\n醉卧沙场君莫笑,古来征战几人回!", - "type": "七言绝句", - "author": "王翰", - "title": "凉州词" - }, - { - "id": 268, - "contents": "故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。", - "type": "七言绝句", - "author": "李白", - "title": "送孟浩然之广陵" - }, - { - "id": 269, - "contents": "朝辞白帝彩云间,千里江陵一日还。\n两岸猿声啼不住,轻舟已过万重山。", - "type": "七言绝句", - "author": "李白", - "title": "下江陵" - }, - { - "id": 270, - "contents": "故园东望路漫漫,双袖龙钟泪不干。\n马上相逢无纸笔,凭君传语报平安。", - "type": "七言绝句", - "author": "岑参", - "title": "逢入京使" - }, - { - "id": 271, - "contents": "岐王宅里寻常见,崔九堂前几度闻。\n正是江南好风景,落花时节又逢君。", - "type": "七言绝句", - "author": "杜甫", - "title": "江南逢李龟年" - }, - { - "id": 272, - "contents": "独怜幽草涧边生,上有黄鹂深树鸣。\n春潮带雨晚来急,野渡无人舟自横。", - "type": "七言绝句", - "author": "韦应物", - "title": "滁州西涧" - }, - { - "id": 273, - "contents": "月落乌啼霜满天,江枫渔火对愁眠。\n姑苏城外寒山寺,夜半钟声到客船。", - "type": "七言绝句", - "author": "张继", - "title": "枫桥夜泊" - }, - { - "id": 274, - "contents": "春城无处不飞花,寒食东风御柳斜。\n日暮汉宫传蜡烛,轻烟散入五侯家。", - "type": "七言绝句", - "author": "韩□", - "title": "寒食" - }, - { - "id": 275, - "contents": "更深月色半人家,北斗阑干南斗斜。\n今夜偏知春气暖,虫声新透绿窗纱。", - "type": "七言绝句", - "author": "刘方平", - "title": "月夜" - }, - { - "id": 276, - "contents": "纱窗日落渐黄昏,金屋无人见泪痕。\n寂寞空庭春欲晚,梨花满地不开门。", - "type": "七言绝句", - "author": "刘方平", - "title": "春怨" - }, - { - "id": 277, - "contents": "岁岁金河复玉关,朝朝马策与刀环。\n三春白雪归青冢,万里黄河绕黑山。", - "type": "七言绝句", - "author": "柳中庸", - "title": "征人怨" - }, - { - "id": 278, - "contents": "玉楼天半起笙歌,风送宫嫔笑语和。\n月殿影开闻夜漏,水晶帘卷近秋河。", - "type": "七言绝句", - "author": "顾况", - "title": "宫词" - }, - { - "id": 279, - "contents": "回乐峰前沙似雪,受降城外月如霜。\n不知何处吹芦管,一夜征人尽望乡。", - "type": "七言绝句", - "author": "李益", - "title": "夜上受降城闻笛" - }, - { - "id": 280, - "contents": "朱雀桥边野草花,乌衣巷口夕阳斜。\n旧时王谢堂前燕,飞入寻常百姓家。", - "type": "七言绝句", - "author": "刘禹锡", - "title": "乌衣巷" - }, - { - "id": 281, - "contents": "新妆宜面下朱楼,深锁春光一院愁。\n行到中庭数花朵,蜻蜓飞上玉搔头。", - "type": "七言绝句", - "author": "刘禹锡", - "title": "春词" - }, - { - "id": 282, - "contents": "泪湿罗巾梦不成,夜深前殿按歌声。\n红颜未老恩先断,斜倚薰笼坐到明。", - "type": "七言绝句", - "author": "白居易", - "title": "后宫词" - }, - { - "id": 283, - "contents": "禁门宫树月痕过,媚眼惟看宿鹭窠。\n斜拔玉钗灯影畔,剔开红焰救飞蛾。", - "type": "七言绝句", - "author": "张祜", - "title": "赠内人" - }, - { - "id": 284, - "contents": "日光斜照集灵台,红树花迎晓露开。\n昨夜上皇新授□(“录”加竹头),太真含笑入帘来。", - "type": "七言绝句", - "author": "张祜", - "title": "集灵台二首之一" - }, - { - "id": 285, - "contents": "虢国夫人承主恩,平明骑马入宫门。\n却嫌脂粉污颜色,淡扫蛾眉朝至尊。", - "type": "七言绝句", - "author": "张祜", - "title": "集灵台二首之二" - }, - { - "id": 286, - "contents": "金陵津渡小山楼,一宿行人自可愁。\n潮落夜江斜月里,两三星火是瓜州。", - "type": "七言绝句", - "author": "张祜", - "title": "题金陵渡" - }, - { - "id": 287, - "contents": "寂寂花时闭院门,美人相并立琼轩。\n含情欲说宫中事,鹦鹉前头不敢言。", - "type": "七言绝句", - "author": "朱庆馀", - "title": "宫词" - }, - { - "id": 288, - "contents": "洞房昨夜停红烛,待晓堂前拜舅姑。\n妆罢低声问夫婿,画眉深浅入时无?", - "type": "七言绝句", - "author": "朱庆馀", - "title": "近试上张水部" - }, - { - "id": 289, - "contents": "清时有味是无能,闲爱孤云静爱僧。\n欲把一麾江海去,乐游原上望昭陵。", - "type": "七言绝句", - "author": "杜牧", - "title": "将赴吴兴登乐游原" - }, - { - "id": 290, - "contents": "折戟沈沙铁未销,自将磨洗认前朝。\n东风不与周郎便,铜雀春深销二乔。", - "type": "七言绝句", - "author": "杜牧", - "title": "赤壁" - }, - { - "id": 291, - "contents": "烟笼寒水月笼沙,夜泊秦淮近酒家。\n商女不知亡国恨,隔江犹唱《后庭花》。", - "type": "七言绝句", - "author": "杜牧", - "title": "泊秦淮" - }, - { - "id": 292, - "contents": "青山隐隐水迢迢,秋尽江南草未凋。\n二十四桥明月夜,玉人何处教吹箫?", - "type": "七言绝句", - "author": "杜牧", - "title": "寄扬州韩绰判官" - }, - { - "id": 293, - "contents": "落魄江湖载酒行,楚腰纤细掌中轻。\n十年一觉扬州梦,赢得青楼薄幸名。", - "type": "七言绝句", - "author": "杜牧", - "title": "遣怀" - }, - { - "id": 294, - "contents": "银烛秋光冷画屏,轻罗小扇扑流萤。\n天阶夜色凉如水,坐看牵牛织女星。", - "type": "七言绝句", - "author": "杜牧", - "title": "秋夕" - }, - { - "id": 295, - "contents": "娉娉袅袅十三馀,豆蔻梢头二月初。\n春风十里扬州路,卷上珠帘总不如。", - "type": "七言绝句", - "author": "杜牧", - "title": "赠别二首之一" - }, - { - "id": 296, - "contents": "多情却似总无情,唯觉樽前笑不成。\n蜡烛有心还惜别,替人垂泪到天明。", - "type": "七言绝句", - "author": "杜牧", - "title": "赠别二首之二" - }, - { - "id": 297, - "contents": "繁华事散逐香尘,流水无情草自春。\n日暮东风怨啼鸟,落花犹似坠楼人。", - "type": "七言绝句", - "author": "杜牧", - "title": "金谷园" - }, - { - "id": 298, - "contents": "君问归期未有期,巴山夜雨涨秋池。\n何当共剪西窗烛,却话巴山夜雨时?", - "type": "七言绝句", - "author": "李商隐", - "title": "夜雨寄北" - }, - { - "id": 299, - "contents": "嵩云秦树久离居,双鲤迢迢一纸笔。\n休问梁园旧宾客,茂陵秋雨病相如。", - "type": "七言绝句", - "author": "李商隐", - "title": "寄令狐郎中" - }, - { - "id": 300, - "contents": "为有云屏无限娇,凤城寒尽怕春宵。\n无端嫁得金龟婿,辜负香衾事早朝。", - "type": "七言绝句", - "author": "李商隐", - "title": "为有" - }, - { - "id": 301, - "contents": "乘兴南游不戒严,九重谁省谏书函?\n春风举国裁宫锦,半作障泥半作帆。", - "type": "七言绝句", - "author": "李商隐", - "title": "隋宫" - }, - { - "id": 302, - "contents": "瑶池阿母绮窗开,黄竹歌声动地哀。\n八骏日行三万里,穆王何事不重来?", - "type": "七言绝句", - "author": "李商隐", - "title": "瑶池" - }, - { - "id": 303, - "contents": "云母屏风烛影深,长河渐落晓星沈。\n嫦娥应悔偷灵药,碧海青天夜夜心。", - "type": "七言绝句", - "author": "李商隐", - "title": "嫦娥" - }, - { - "id": 304, - "contents": "宣室求贤访逐臣,贾生才调更无伦。\n可怜夜半虚前席,不问苍生问鬼神!", - "type": "七言绝句", - "author": "李商隐", - "title": "贾生" - }, - { - "id": 305, - "contents": "冰簟银床梦不成,碧天如水夜云轻。\n雁声远过潇湘去,十二楼中月自明。", - "type": "七言绝句", - "author": "温庭筠", - "title": "瑶瑟怨" - }, - { - "id": 306, - "contents": "玄宗回马杨妃死,云雨难忘日月新。\n终是圣明天子事,景阳宫井又何人?", - "type": "七言绝句", - "author": "郑畋", - "title": "马嵬坡" - }, - { - "id": 307, - "contents": "碧阑干外绣帘垂,猩色屏风画折枝。\n八尺龙须方锦褥,已凉天气未寒时。", - "type": "七言绝句", - "author": "韩□", - "title": "已凉" - }, - { - "id": 308, - "contents": "江雨霏霏江草齐,六朝如梦鸟空啼。\n无情最是台城柳,依旧烟笼十里堤。", - "type": "七言绝句", - "author": "韦庄", - "title": "金陵图" - }, - { - "id": 309, - "contents": "誓扫匈奴不顾身,五千貂锦丧胡尘。\n可怜无定河边骨,犹是深闺梦里人!", - "type": "七言绝句", - "author": "陈陶", - "title": "陇西行" - }, - { - "id": 310, - "contents": "别梦依依到谢家,小廊回合曲阑斜。\n多情只有春庭月,犹为离人照落花。", - "type": "七言绝句", - "author": "张泌", - "title": "寄人" - }, - { - "id": 311, - "contents": "尽寒食雨草萋萋,著麦苗风柳映堤。\n等是有家归未得,杜鹃休向耳边啼。", - "type": "七言绝句", - "author": "无名氏", - "title": "杂诗" - }, - { - "id": 312, - "contents": "渭城朝雨[氵邑]轻尘,客舍青青柳色新。\n劝君更尽一杯酒,西出阳关无故人。", - "type": "七言绝句", - "author": "王维", - "title": "渭城曲" - }, - { - "id": 313, - "contents": "桂魄初生秋露微,轻罗已薄未更衣。\n银筝夜久殷勤弄,心怯空房不忍归!", - "type": "七言绝句", - "author": "王维", - "title": "秋夜曲" - }, - { - "id": 314, - "contents": "奉帚平明金殿开,且将团扇共徘徊。\n玉颜不及寒鸦色,犹带昭阳日影来。", - "type": "七言绝句", - "author": "王昌龄", - "title": "长信怨" - }, - { - "id": 315, - "contents": "秦时明月汉时关,万里长征人未还。\n但使龙城飞将在,不教胡马渡阴山!", - "type": "七言绝句", - "author": "王昌龄", - "title": "出塞" - }, - { - "id": 316, - "contents": "黄河远上白云间,一片孤城万仞山。\n羌笛何须怨杨柳?春风不度玉门关。", - "type": "七言绝句", - "author": "王之涣", - "title": "出塞" - }, - { - "id": 317, - "contents": "云想衣裳花想容,春风拂槛露华浓。\n若非群玉山头见,会向瑶台月下逢。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之一" - }, - { - "id": 318, - "contents": "一枝红艳露凝香,云雨巫山枉断肠。\n借问汉宫谁得似?可怜飞燕倚新妆。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之二" - }, - { - "id": 319, - "contents": "名花倾国两相欢,常得君王带笑看。\n解释春风无限恨,沈香亭北倚阑干。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之三" - }, - { - "id": 320, - "contents": "劝君莫惜金缕衣,劝君惜取少年时。\n花开堪折直须折,莫待无花空折枝!", - "type": "七言绝句", - "author": "杜秋娘", - "title": "金缕衣" - } -] diff --git a/exercises/1901050193/1001S02E05_stats_text.py b/exercises/1901050193/1001S02E05_stats_text.py index c05d2e966..7bac240a9 100644 --- a/exercises/1901050193/1001S02E05_stats_text.py +++ b/exercises/1901050193/1001S02E05_stats_text.py @@ -32,7 +32,7 @@ counter = {} #建立空字典 wordset = set(wordlist) #单词集合 -for singleword in wordset: +for singleword in wordlist: counter[singleword] = wordlist.count(singleword) print('计数:',counter) diff --git a/exercises/1901050193/1001S02E05_string.py b/exercises/1901050193/1001S02E05_string.py index 4da8ee593..d7476dc00 100644 --- a/exercises/1901050193/1001S02E05_string.py +++ b/exercises/1901050193/1001S02E05_string.py @@ -42,5 +42,4 @@ #1.4 Sort from a to z print('1.4 Sort from a to z.',end='\n') -print(sorted(swap)) -#如果想从z到a排序 要怎么排呢 reverse=True并不行 +print(sorted(swap)) \ No newline at end of file diff --git a/exercises/1901050193/1001S02E06_stats_word.py b/exercises/1901050193/1001S02E06_stats_word.py index 4e2b3b05c..d063172d8 100644 --- a/exercises/1901050193/1001S02E06_stats_word.py +++ b/exercises/1901050193/1001S02E06_stats_word.py @@ -13,7 +13,7 @@ def stats_text_en(text): for singleword in wordset: counter[singleword] = wordlist.count(singleword) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) #返回函数结果 + return sorted(counter.items(), key=lambda x: x[1], reverse=True) #返回函数结果 #定义函数2:统计文档中中文单词出现的次数并按照频率降序排列。 @@ -108,12 +108,4 @@ def stats_text_cn(text): en_result = stats_text_en(en_text) #给函数的返回结果一个值 cn_result = stats_text_cn(cn_text) #中文同上 print('英文单词按出现次数降序排列:\n', en_result) - print('中文单字按出现次数降序排列:\n', cn_result) - -#在python中,每个模块都有一个叫_name_的内置变量,这个变量的值会根据该模块被使用的方式而变化: -# 1、假设模块A.py 在另一个模块 B.py 中,被作为模块导入,则_name_的值为模块 A.py 的名称 -# 2、假设模块 A.py被直接执行,则_name_ 的值为_main_ -# 英文参考:https://stackoverflow.com/questions/419163/what-does-if-name-main-do - -#那么中文按照拼音开头排序呢 - + print('中文单字按出现次数降序排列:\n', cn_result) \ No newline at end of file diff --git a/exercises/1901050193/README.md b/exercises/1901050193/README.md index 97d0d3da4..e69de29bb 100644 --- a/exercises/1901050193/README.md +++ b/exercises/1901050193/README.md @@ -1,5 +0,0 @@ -#一些零碎的记录Day05 -1.python中的变量不需要声明,但使用时必须赋值 - 1.整形变量 - 2.浮点型变量 - 3.字符型 diff --git a/exercises/1901050193/d07/mymodule/main.py b/exercises/1901050193/d07/mymodule/main.py deleted file mode 100644 index 7ea92cb24..000000000 --- a/exercises/1901050193/d07/mymodule/main.py +++ /dev/null @@ -1,66 +0,0 @@ -from stats_word import stats_text - -sample_text = ''' -愚公移⼭山 -太⾏行行,王屋⼆二⼭山的北北⾯面,住了了⼀一個九⼗十歲的⽼老老翁,名叫愚公。⼆二⼭山佔地廣闊,擋住去路路,使他 -和家⼈人往來來極為不不便便。 -⼀一天,愚公召集家⼈人說:「讓我們各盡其⼒力力,剷平⼆二⼭山,開條道路路,直通豫州,你們認為怎 -樣?」 -⼤大家都異異⼝口同聲贊成,只有他的妻⼦子表示懷疑,並說:「你連開鑿⼀一個⼩小丘的⼒力力量量都沒有,怎 -可能剷平太⾏行行、王屋⼆二⼭山呢?況且,鑿出的⼟土⽯石⼜又丟到哪裏去呢?」 -⼤大家都熱烈烈地說:「把⼟土⽯石丟進渤海海裏。」 -於是愚公就和兒孫,⼀一起開挖⼟土,把⼟土⽯石搬運到渤海海去。 -愚公的鄰居是個寡婦,有個兒⼦子⼋八歲也興致勃勃地⾛走來來幫忙。 -寒來來暑往,他們要⼀一年年才能往返渤海海⼀一次。 -住在⿈黃河河畔的智叟,看⾒見見他們這樣⾟辛苦,取笑愚公說:「你不不是很愚蠢嗎?你已⼀一把年年紀 -了了,就是⽤用盡你的氣⼒力力,也不不能挖去⼭山的⼀一⻆角呢?」 -愚公歎息道:「你有這樣的成⾒見見,是不不會明⽩白的。你⽐比那寡婦的⼩小兒⼦子還不不如呢!就算我死 -了了,還有我的兒⼦子,我的孫⼦子,我的曾孫⼦子,他們⼀一直傳下去。⽽而這⼆二⼭山是不不會加⼤大的,總有 -⼀一天,我們會把它們剷平。」 -智叟聽了了,無話可說: -⼆二⼭山的守護神被愚公的堅毅精神嚇倒,便便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤大 -⼒力力神揹⾛走⼆二⼭山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' - -result = stats_text(sample_text) - -print('中英统计结果=', result) \ No newline at end of file diff --git a/exercises/1901050193/d07/mymodule/stats_word.py b/exercises/1901050193/d07/mymodule/stats_word.py deleted file mode 100644 index 97c550251..000000000 --- a/exercises/1901050193/d07/mymodule/stats_word.py +++ /dev/null @@ -1,119 +0,0 @@ -#定义函数1:统计参数中每个英⽂文单词出现的次数,最后返回⼀个按词频降序排列列的数组。 -def stats_text_en(text): - words = text.split() - wordlist = [] - symbols = ',.*-!' - for word in words: - for symbol in symbols: - word = word.replace(symbol,'') - if len(word) and word.isascii(): - wordlist.append(word) - counter = {} - wordset = set(wordlist) - - for singleword in wordset: - counter[singleword] = wordlist.count(singleword) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) #返回函数结果 - - -#定义函数2:统计文档中中文单词出现的次数并按照频率降序排列。 -def stats_text_cn(text): - cnsymbols=[] - for cnsymbol in text: - if '\u4e00'<= cnsymbol<='\u9fff': #判断是否属于中文单字,可以直接过滤掉符号等等了。 - cnsymbols.append(cnsymbol) - counter={} - cnsymbols_set=set(cnsymbols) - for cnsymbol in cnsymbols_set: - counter[cnsymbol]=cnsymbols.count(cnsymbol) - return sorted(counter.items(), key = lambda x: x[1], reverse=True) #同上返回函数结果 - - -def stats_text(text): -#合并 英文词频 和中文词频 的结果 - return stats_text_en(text) + stats_text_cn(text) - - -en_text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those!" -''' -cn_text=''' -优美优于丑陋, - -明了优于隐晦; - -简单优于复杂, - -复杂优于凌乱, - -扁平优于嵌套, - -可读性很重要! - -即使实用比纯粹更优, - -特例亦不可违背原则。 - -错误绝不能悄悄忽略, - -除非它明确需要如此。 - -面对不确定性, - -拒绝妄加猜测。 - -任何问题应有一种, - -且最好只有一种, - -显而易见的解决方法。 - -尽管这方法一开始并非如此直观, - -除非你是荷兰人。 - -做优于不做, - -然而不假思索还不如不做。 - -很难解释的,必然是坏方法。 - -很好解释的,可能是好方法。 - -命名空间是个绝妙的主意, - -我们应好好利用它。 - -''' - -if __name__=='__main__': - # if _name_=='_main_':"的作用在于:如果直接执行含有该语句的模块,则执行该语句后续部分; - # 若在另一个模块中调用含有该语句的模块时,该语句的后续部分不执行。 - - en_result = stats_text_en(en_text) #给函数的返回结果一个值 - cn_result = stats_text_cn(cn_text) #中文同上 - print('英文单词按出现次数降序排列:\n', en_result) - print('中文单字按出现次数降序排列:\n', cn_result) - - - diff --git a/exercises/1901050193/d09/mymodule/main.py b/exercises/1901050193/d09/mymodule/main.py deleted file mode 100644 index 50a9a454a..000000000 --- a/exercises/1901050193/d09/mymodule/main.py +++ /dev/null @@ -1,9 +0,0 @@ -import stats_word - -with open('D:\\文档\\Pythonlernen-ss01\\selfteaching-python-camp\\exercises\\1901050193\\d09\\mymodule\\tang300.json',mode='r', encoding='UTF-8') as f: - text = f.read() - -try: - stats_word.stats_text(text,100) -except ValueError: - print('非字符串,请重新输入') \ No newline at end of file diff --git a/exercises/1901050193/d09/mymodule/stats_word.py b/exercises/1901050193/d09/mymodule/stats_word.py deleted file mode 100644 index 21184a76f..000000000 --- a/exercises/1901050193/d09/mymodule/stats_word.py +++ /dev/null @@ -1,127 +0,0 @@ -import re -from collections import Counter - -#定义函数1:统计参数中每个英⽂文单词出现的次数,最后返回⼀个按词频降序排列列的数组。 -def stats_text_en(text,count): - if type(text)!= str: - raise ValueError('非字符串类型') #遇到非字符串类型时,抛出错误 - else: - pass - - - words = text.split() - wordlist = [] - symbols = ',.*-!' #过滤符号 - - - for word in words: - for symbol in symbols: - word = word.replace(symbol,'') - if len(word) and word.isascii(): - wordlist.append(word) - - - counter = Counter(wordlist).most_common(count) #使⽤用标准库中的 Counter 来完善统计功能 - return sorted(dict(counter).items(), key = lambda x:x[1],reverse = True) - - - - -#定义函数2:统计文档中中文单词出现的次数并按照频率降序排列。 -def stats_text_cn(text,count): - if type(text)!= str: - raise ValueError('非字符串类型') - else: - pass - - - cnsymbols=[] - for cnsymbol in text: - if '\u4e00'<= cnsymbol<='\u9fff': #判断是否属于中文单字,可以直接过滤掉符号等等了。 - cnsymbols.append(cnsymbol) - - - counter = Counter(cnsymbols).most_common(count) #使⽤用标准库中的 Counter 来完善统计功能 - return sorted(dict(counter).items(), key = lambda x:x[1],reverse = True) - -def stats_text(text,count): -#合并 英文词频 和中文词频 的结果 - if type(text)!= str: - raise ValueError('非字符串类型') - else: - pass - print("文本中的中文汉字词频为:\n", stats_text_cn(text, count)) - print("文本中的英文单词词频为:\n", stats_text_en(text, count)) - - -en_text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those!" -''' -cn_text=''' -优美优于丑陋, - -明了优于隐晦; - -简单优于复杂, - -复杂优于凌乱, - -扁平优于嵌套, - -可读性很重要! - -即使实用比纯粹更优, - -特例亦不可违背原则。 - -错误绝不能悄悄忽略, - -除非它明确需要如此。 - -面对不确定性, - -拒绝妄加猜测。 - -任何问题应有一种, - -且最好只有一种, - -显而易见的解决方法。 - -尽管这方法一开始并非如此直观, - -除非你是荷兰人。 - -做优于不做, - -然而不假思索还不如不做。 - -很难解释的,必然是坏方法。 - -很好解释的,可能是好方法。 - -命名空间是个绝妙的主意, - -我们应好好利用它。 - -''' diff --git a/exercises/1901050193/d10/mymodule/main.py b/exercises/1901050193/d10/mymodule/main.py deleted file mode 100644 index baae2c164..000000000 --- a/exercises/1901050193/d10/mymodule/main.py +++ /dev/null @@ -1,11 +0,0 @@ -import stats_word -import os - -with open('D:\\文档\\Pythonlernen-ss01\\selfteaching-python-camp\\exercises\\1901050193\\d09\\mymodule\\tang300.json',mode='r', encoding='UTF-8') as f: - text = f.read() - #从文件读取指定的字节数,如果未给定或为负则读取所有。 - -try: - print("唐诗三百首中的词频前 20 的词和词频数:\n",stats_word.stats_text_cn(text,20)) -except ValueError: - print('非字符串,请重新输入') \ No newline at end of file diff --git a/exercises/1901050193/d10/mymodule/stats_word.py b/exercises/1901050193/d10/mymodule/stats_word.py deleted file mode 100644 index 99a26866a..000000000 --- a/exercises/1901050193/d10/mymodule/stats_word.py +++ /dev/null @@ -1,102 +0,0 @@ -from collections import Counter -import jieba -import re - - -#定义函数stats_text_cn 用于统计文档中中文单词出现的次数并按照频率降序排列。 -def stats_text_cn(text,count): - if type(text)!= str: - raise ValueError('非字符串类型') - else: - pass - #提前处理掉所有非中文部分 - #[^\u4e00-\u9fa5]表示所有非中文 - text = re.sub('[^\u4e00-\u9fa5]','',text) - - #jieba 用精确模式分词 - seg_list = jieba.cut(text, cut_all=False) - - #只统计长度大2的词 - seg_dic = [] - for word in seg_list: - if len(word)>=2: - seg_dic.append(word) - - counter = Counter(seg_dic).most_common(count) #使⽤用标准库中的 Counter 来完善统计功能 - return sorted(dict(counter).items(), key = lambda x:x[1],reverse = True) - - -text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those!" - -优美优于丑陋, - -明了优于隐晦; - -简单优于复杂, - -复杂优于凌乱, - -扁平优于嵌套, - -可读性很重要! - -即使实用比纯粹更优, - -特例亦不可违背原则。 - -错误绝不能悄悄忽略, - -除非它明确需要如此。 - -面对不确定性, - -拒绝妄加猜测。 - -任何问题应有一种, - -且最好只有一种, - -显而易见的解决方法。 - -尽管这方法一开始并非如此直观, - -除非你是荷兰人。 - -做优于不做, - -然而不假思索还不如不做。 - -很难解释的,必然是坏方法。 - -很好解释的,可能是好方法。 - -命名空间是个绝妙的主意, - -我们应好好利用它。 - -''' - - -if __name__=='__main__': - print('中文单字按出现次数降序排列:\n', stats_text_cn(text,20)) \ No newline at end of file diff --git a/exercises/1901050193/d11/mymodule/main.py b/exercises/1901050193/d11/mymodule/main.py deleted file mode 100644 index 8008a5f74..000000000 --- a/exercises/1901050193/d11/mymodule/main.py +++ /dev/null @@ -1,27 +0,0 @@ -import stats_word -import os -import yagmail -import requests -import pyquery - -#获取微信公众号文章返还结果'response' -r = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - -from pyquery import PyQuery -#完成内容抓取 -document = PyQuery(r.text) -#正文内容获取 -content = document('#js_content').text() - -#对内容进行str类型转换 -tongji = stats_word.stats_text_cn(content,100) -str_zxl = str(tongji) - -import getpass -sender = input('输入发件⼈邮箱:') -password = getpass.getpass('输入发件⼈邮箱密码(可复制粘贴):') -recipients = input('输入收件⼈邮箱:') - -yag = yagmail.SMTP(user = sender, password = password, host = 'smtp.126.com') -#发送邮件 -yag.send(recipients,'自学训练营学习4群,github:Konaair,day11',str_zxl) \ No newline at end of file diff --git a/exercises/1901050193/d11/mymodule/stats_word.py b/exercises/1901050193/d11/mymodule/stats_word.py deleted file mode 100644 index 7d8971657..000000000 --- a/exercises/1901050193/d11/mymodule/stats_word.py +++ /dev/null @@ -1,103 +0,0 @@ -from collections import Counter -import jieba -import re - - -#定义函数stats_text_cn 用于统计文档中中文单词出现的次数并按照频率降序排列。 -def stats_text_cn(text,count): - if type(text)!= str: - raise ValueError('非字符串类型') - else: - pass - #提前处理掉所有非中文部分 - #[^\u4e00-\u9fa5]表示所有非中文 - text = re.sub('[^\u4e00-\u9fa5]','',text) - - #jieba 用精确模式分词 - seg_list = jieba.cut(text, cut_all=False) - - #只统计长度大2的词 - seg_dic = [] - for word in seg_list: - if len(word)>=2: - seg_dic.append(word) - - - counter = Counter(seg_dic).most_common(count) #使⽤用标准库中的 Counter 来完善统计功能 - return sorted(dict(counter).items(), key = lambda x:x[1],reverse = True) - - -text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those!" - -优美优于丑陋, - -明了优于隐晦; - -简单优于复杂, - -复杂优于凌乱, - -扁平优于嵌套, - -可读性很重要! - -即使实用比纯粹更优, - -特例亦不可违背原则。 - -错误绝不能悄悄忽略, - -除非它明确需要如此。 - -面对不确定性, - -拒绝妄加猜测。 - -任何问题应有一种, - -且最好只有一种, - -显而易见的解决方法。 - -尽管这方法一开始并非如此直观, - -除非你是荷兰人。 - -做优于不做, - -然而不假思索还不如不做。 - -很难解释的,必然是坏方法。 - -很好解释的,可能是好方法。 - -命名空间是个绝妙的主意, - -我们应好好利用它。 - -''' - - -if __name__=='__main__': - print('中文单字按出现次数降序排列:\n', stats_text_cn(text,20)) \ No newline at end of file diff --git a/exercises/1901080018/QR.png b/exercises/1901080018/QR.png deleted file mode 100644 index 3ba62f865..000000000 Binary files a/exercises/1901080018/QR.png and /dev/null differ diff --git a/exercises/1901080018/d12/mymodule/main.py b/exercises/1901080018/d12/mymodule/main.py deleted file mode 100644 index a87f492cd..000000000 --- a/exercises/1901080018/d12/mymodule/main.py +++ /dev/null @@ -1,16 +0,0 @@ -from wxpy import * -bot = Bot() -my_friend = bot.friends().search("波罗",sex=MALE,city='广州')[0] -my_friend.send('我找到你了') -@bot.register(chats =None,msg_types = 'Sharing',except_self = True) -def auto_reply(msg): - import requests - from pyquery import PyQuery - import stats_word - response = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - document = PyQuery(response.text) - content = document('#js_content').text() - list1 = stats_word.stats_text(content,100) - str1 = "".join([str(i) for i in list1]) - return str1 -embed() \ No newline at end of file diff --git a/exercises/1901080018/d12/mymodule/stats_word.py b/exercises/1901080018/d12/mymodule/stats_word.py deleted file mode 100644 index 6621f4f8b..000000000 --- a/exercises/1901080018/d12/mymodule/stats_word.py +++ /dev/null @@ -1,32 +0,0 @@ - - -import jieba -import re -import collections -def stats_text_en(en,count): - if isinstance(en,str): - d = {} - t1 = re.sub(u"([^\u0041-\u005a\u0061-\u007a\'])"," ",en) - t2 = t1.split() - d=collections.Counter(t2).most_common(count) - return d - else: - raise ValueError ("输入的不是文本,请重新输入") -def stats_text_cn(cn,count): - if isinstance(cn,str): - d={} - t2=[] - t1=re.sub(u"([^\u4e00-\u9fa5])","",cn) - seg_list = jieba.cut(t1,cut_all=False) - for i in seg_list: - if len(i) >= 2: - t2.append(i) - d=collections.Counter(t2).most_common(count) - return d - else: - raise ValueError("输入的不是文本,请重新输入") -def stats_text(ec,count): #创建stats_text函数 - if isinstance(ec,str): #如果ec是字符串,则运行下面一行的代码。 - return stats_text_cn(ec,count) + stats_text_en(ec,count) #返回值为stats_text_cn(ec)和stats_text_en(ec)的结果。 - else: #否则提示错误:输入的不是文本。。。。。。 - raise ValueError ("输入的不是文本,请重新输入") \ No newline at end of file diff --git a/exercises/1901080018/d12/mymodule/tang300.json b/exercises/1901080018/d12/mymodule/tang300.json deleted file mode 100644 index 3d22e82ae..000000000 --- a/exercises/1901080018/d12/mymodule/tang300.json +++ /dev/null @@ -1,2235 +0,0 @@ -[ - { - "id": 1, - "contents": "孤鸿海上来,池潢不敢顾。\n侧见双翠鸟,巢在三珠树。\n矫矫珍木巅,得无金丸惧。\n美服患人指,高明逼神恶。\n今我游冥冥,弋者何所慕。", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之一" - }, - { - "id": 2, - "contents": "兰叶春葳蕤,桂华秋皎洁。\n欣欣此生意,自尔为佳节。\n谁知林栖者,闻风坐相悦。\n草木有本心,何求美人折?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之二" - }, - { - "id": 3, - "contents": "幽人归独卧,滞虑洗孤清。\n持此谢高鸟,因之传远情。\n日夕怀空意,人谁感至精?\n飞沈理自隔,何所慰吾诚?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之三" - }, - { - "id": 4, - "contents": "江南有丹橘,经冬犹绿林。\n岂伊地气暖,自有岁寒心。\n可以荐嘉客,奈何阻重深!\n运命惟所遇,循环不可寻。\n徒言树桃李,此木岂无阴?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之四" - }, - { - "id": 5, - "contents": "暮从碧山下,山月随人归,\n却顾所来径,苍苍横翠微。\n相携及田家,童稚开荆扉。\n绿竹入幽径,青萝拂行衣。\n欢言得所憩,美酒聊共挥。\n长歌吟松风,曲尽河星稀。\n我醉君复乐,陶然共忘机。", - "type": "五言古诗", - "author": "李白", - "title": "下终南山过斛斯山人宿置酒" - }, - { - "id": 6, - "contents": "花间一壶酒,独酌无相亲。\n举杯邀明月,对影成三人。\n月既不解饮,影徒随我身。\n暂伴月将影,行乐须及春。\n我歌月徘徊,我舞影零乱。\n醒时同交欢,醉后各分散。\n永结无情游,相期邈云汉。", - "type": "五言古诗", - "author": "李白", - "title": "月下独酌" - }, - { - "id": 7, - "contents": "燕草如碧丝,秦桑低绿枝。\n当君怀归日,是妾断肠时。\n春风不相识,何事入罗帏?", - "type": "五言古诗", - "author": "李白", - "title": "春思" - }, - { - "id": 8, - "contents": "岱宗夫如何,齐鲁青未了。\n造化钟神秀,阴阳割昏晓。\n荡胸生层云,决眦入归鸟,\n会当凌绝顶,一览众山小。", - "type": "五言古诗", - "author": "杜甫", - "title": "望岳" - }, - { - "id": 9, - "contents": "人生不相见,动如参与商。\n今夕复何夕,共此灯烛光。\n少壮能几时,鬓发各已苍。\n访旧半为鬼,惊呼热中肠。\n焉知二十载,重上君子堂。\n昔别君未婚,儿女忽成行。\n怡然敬父执,问我来何方。\n问答乃未已,驱儿罗酒浆。\n夜雨剪春韭,新炊间黄粱。\n主称会面难,一举累十觞。\n十觞亦不醉,感子故意长。\n明日隔山岳,世事两茫茫。", - "type": "五言古诗", - "author": "杜甫", - "title": "赠卫八处士" - }, - { - "id": 10, - "contents": "绝代有佳人,幽居在空谷。\n自云良家子,零落依草木。\n关中昔丧乱,兄弟遭杀戮。\n官高何足论,不得收骨肉。\n世情恶衰歇,万事随转烛。\n夫婿轻薄儿,新人美如玉。\n合昏尚知时,鸳鸯不独宿。\n但见新人笑,那闻旧人哭!\n在山泉水清,出山泉水浊。\n侍婢卖珠回,牵萝补茅屋。\n摘花不插发,采柏动盈掬。\n天寒翠袖薄,日暮倚修竹。", - "type": "五言古诗", - "author": "杜甫", - "title": "佳人" - }, - { - "id": 11, - "contents": "死别已吞声,生别常恻恻。\n江南瘴疠地,逐客无消息。\n故人入我梦,明我长相忆。\n君今在罗网,何以有羽翼?\n恐非平生魂,路远不可测。\n魂来枫林青,魂返关塞黑。\n落月满屋梁,犹疑照颜色。\n水深波浪阔,无使蛟龙得。", - "type": "五言古诗", - "author": "杜甫", - "title": "梦李白二首之一" - }, - { - "id": 12, - "contents": "浮云终日行,游子久不至。\n三夜频梦君,情亲见君意。\n告归常局促,苦道来不易。\n江湖多风波,舟楫恐失坠。\n出门搔白首,若负平生志。\n冠盖满京华,斯人独憔悴。\n孰云网恢恢,将老身反累。\n千秋万岁名,寂寞身后事。", - "type": "五言古诗", - "author": "杜甫", - "title": "梦李白二首之二" - }, - { - "id": 13, - "contents": "下马饮君酒,问君何所之。\n君言不得意,归卧南山陲。\n但去莫复闻,白云无尽时。", - "type": "五言古诗", - "author": "王维", - "title": "送别" - }, - { - "id": 14, - "contents": "圣代无隐者,英灵尽来归。\n遂令东山客,不得顾采薇。\n既至金门远,孰云吾道非?\n江淮度寒食,京洛缝春衣。\n置酒长安道,同心与我违。\n行当浮桂棹,未几拂荆扉。\n远树带行客,孤城当落晖。\n吾谋适不用,勿谓知音稀。", - "type": "五言古诗", - "author": "王维", - "title": "送綦毋潜落第还乡" - }, - { - "id": 15, - "contents": "言入黄花川,每逐青溪水。\n随山将万转,趣途无百里。\n声喧乱石中,色静深松里。\n漾漾泛菱荇,澄澄映葭苇。\n我心素已闲,清川澹如此。\n请留盘石上,垂钓将已矣。", - "type": "五言古诗", - "author": "王维", - "title": "青溪" - }, - { - "id": 16, - "contents": "斜光照墟落,穷巷牛羊归。\n野老念牧童,倚杖候荆扉。\n雉[句隹]麦苗秀,蚕眠桑叶稀。\n田夫荷锄立,相见语依依。\n即此羡闲逸,怅然吟式微。", - "type": "五言古诗", - "author": "王维", - "title": "渭川田家" - }, - { - "id": 17, - "contents": "艳色天下重,西施宁久微。\n朝为越溪女,暮作吴宫妃。\n贱日岂殊众,贵来方悟稀。\n邀人傅脂粉,不自著罗衣。\n君宠益娇态,君怜无是非。\n当时浣纱伴,莫得同车归。\n持谢邻家子,效颦安可希!", - "type": "五言古诗", - "author": "王维", - "title": "西施咏" - }, - { - "id": 18, - "contents": "北山白云里,隐者自怡悦。\n相望始登高,心随雁飞灭。\n愁因薄暮起,兴是清秋发。\n时见归村人,沙行渡头歇。\n天边树若荠,江畔洲如月。\n何当载酒来,共醉重阳节。", - "type": "五言古诗", - "author": "孟浩然", - "title": "秋登兰山寄张五" - }, - { - "id": 19, - "contents": "山光忽西落,池月渐东上。\n散发乘夜凉,开轩卧闲敞。\n荷风送香气,竹露滴清响。\n欲取鸣琴弹,恨无知音赏。\n感此怀故人,中宵劳梦想。", - "type": "五言古诗", - "author": "孟浩然", - "title": "夏日南亭怀辛大" - }, - { - "id": 20, - "contents": "夕阳度西岭,群壑倏已暝。\n松月生夜凉,风泉满清听。\n樵人归欲尽,烟鸟栖初定。\n之子期宿来,孤琴候萝径。", - "type": "五言古诗", - "author": "孟浩然", - "title": "宿业师山房待丁大不至" - }, - { - "id": 21, - "contents": "高卧南斋时,开帷月初吐。\n清辉淡水木,演漾在窗户。\n苒苒几盈虚,澄澄变今古。\n美人清江畔,是夜越吟苦。\n千里其如何,微风吹兰杜。", - "type": "五言古诗", - "author": "王昌龄", - "title": "同从弟南斋玩月忆山阴崔少府" - }, - { - "id": 22, - "contents": "绝顶一茅茨,直上三十里。\n扣关无僮仆,窥室惟案几。\n若非巾柴车,应是钓秋水。\n差池不相见,黾勉空仰止。\n草色新雨中,松声晚窗里。\n及兹契幽绝,自足荡心耳。\n虽无宾主意,颇得清净理。\n兴尽方下山,何必待之子。", - "type": "五言古诗", - "author": "邱为", - "title": "寻西山隐者不遇" - }, - { - "id": 23, - "contents": "幽意无断绝,此去随所偶。\n晚风吹行舟,花路入溪口。\n际夜转西壑,隔山望南斗。\n潭烟飞溶溶,林月低向后。\n生事且弥漫,愿为持竿叟。", - "type": "五言古诗", - "author": "綦毋潜", - "title": "春泛若耶溪" - }, - { - "id": 24, - "contents": "清溪深不测,隐处唯孤云。\n松际露微月,清光犹为君。\n茅亭宿花影,药院滋苔纹。\n余亦谢时去,西山鸾鹤群。", - "type": "五言古诗", - "author": "常建", - "title": "宿王昌龄隐居" - }, - { - "id": 25, - "contents": "塔势如涌出,孤高耸天宫。\n登临出世界,磴道盘虚空。\n突兀压神州,峥嵘如鬼工。\n四角碍白日,七层摩苍穹。\n下窥指高鸟,俯听闻惊风。\n连山若波涛,奔凑如朝东。\n青槐夹驰道,宫馆何玲珑!\n秋色从西来,苍然满关中。\n五陵北原上,万古青蒙蒙。\n净理了可悟,胜因夙所宗。\n誓将挂冠去,觉道资无穷。", - "type": "五言古诗", - "author": "岑参", - "title": "与高适薛据登慈恩寺浮图" - }, - { - "id": 26, - "contents": "癸卯岁,西原贼入道州,焚烧杀掠,几尽而去。明年,贼又攻永州,破邵,不犯此\n州边鄙而退,岂力能制敌欤?盖蒙其伤怜而已!诸史何为忍苦征敛!故作诗一篇以\n示官吏。\n昔岁逢太平,山林二十年。\n泉源在庭户,洞壑当门前。\n井税有常期,日晏犹得眠。\n忽然遭时变,数岁亲戎旃。\n今来典斯郡,山夷又纷然。\n城小贼不屠,人贫伤可怜。\n是以陷邻境,此州独见全。\n使臣将王命,岂不如贼焉!\n令彼征敛者,迫之如火煎。\n谁能绝人命,以作时世贤。\n思欲委符节,引竿自刺船。\n将家就鱼麦,归老江湖边。", - "type": "五言古诗", - "author": "元结", - "title": "贼退示官吏并序" - }, - { - "id": 27, - "contents": "兵卫森画戟,宴寝凝清香。\n海上风雨至,逍遥池阁凉。\n烦疴近消散,嘉宾复满堂。\n自惭居处崇,未睹斯民康。\n理会是非遣,性达形迹忘。\n鲜肥属时禁,蔬果幸见尝。\n俯饮一杯酒,仰聆金玉章。\n神欢体自轻,意欲凌风翔。\n吴中盛文史,群彦今汪洋。\n方知大蕃地,岂曰财赋强。", - "type": "五言古诗", - "author": "韦应物", - "title": "郡斋雨中与诸文士燕集" - }, - { - "id": 28, - "contents": "凄凄去亲爱,泛泛入烟雾。\n归棹洛阳人,残钟广陵树。\n今朝为此别,何处还相遇。\n世事波上舟,沿洄安得住。", - "type": "五言古诗", - "author": "韦应物", - "title": "初发扬子寄元大校书" - }, - { - "id": 29, - "contents": "今朝郡斋冷,忽念山中客。\n涧底束荆薪,归来煮白石。\n欲持一瓢酒,远慰风雨夕。\n落叶满空山,何处寻行迹。", - "type": "五言古诗", - "author": "韦应物", - "title": "寄全椒山中道士" - }, - { - "id": 30, - "contents": "客从东方来,衣上灞陵雨。\n问客何为来,采山因买斧。\n冥冥花正开,扬扬燕新乳。\n昨别今已春,鬓丝生几缕。", - "type": "五言古诗", - "author": "韦应物", - "title": "长安遇冯著" - }, - { - "id": 31, - "contents": "落帆逗淮镇,停舫临孤驿。\n浩浩风起波,冥冥日沈夕。\n人归山郭暗,雁下芦洲白。\n独夜忆秦关,听钟未眠客。", - "type": "五言古诗", - "author": "韦应物", - "title": "夕次盱眙县" - }, - { - "id": 32, - "contents": "吏舍局终年,出郊旷清曙。\n杨柳散和风,青山澹吾虑。\n依丛适自憩,缘涧还复去。\n微雨霭芳原,春鸠鸣何处?\n乐幽心屡止,遵事迹犹遽。\n终罢斯结庐,慕陶真可庶。", - "type": "五言古诗", - "author": "韦应物", - "title": "东郊" - }, - { - "id": 33, - "contents": "永日方戚戚,出行复悠悠。\n女子今有行,大江溯轻舟。\n尔辈苦无恃,抚念益慈柔。\n幼为长所育,两别泣不休。\n对此结中肠,义往难复留!\n自小阙内训,事姑贻我忧。\n赖兹托令门,仁恤庶无尤。\n贫俭诚所尚,资从岂待周?\n孝恭遵妇道,容止顺其猷。\n别离在今晨,见尔当何秋。\n居闲始自遣,临感忽难收。\n归来视幼女,零泪缘缨流。", - "type": "五言古诗", - "author": "韦应物", - "title": "送杨氏女" - }, - { - "id": 34, - "contents": "汲井漱寒齿,清心拂尘服。\n闲持贝叶书,步出东斋读。\n真源了无取,忘迹世所逐。\n遗言冀可冥,缮性何由熟?\n道人庭宇静,苔色连深竹。\n日出雾露馀,青松如膏沐。\n澹然离言说,悟悦心自足。", - "type": "五言古诗", - "author": "柳宗元", - "title": "晨诣超师院读禅经" - }, - { - "id": 35, - "contents": "久为簪组累,幸此南夷谪。\n闲依农圃邻,偶似山林客。\n晓耕翻露草,夜榜响溪石。\n来往不逢人,长歌楚天碧。", - "type": "五言古诗", - "author": "柳宗元", - "title": "溪居" - }, - { - "id": 36, - "contents": "蝉鸣空桑林,八月萧关道。\n出塞复入塞,处处黄芦草。\n从来幽并客,皆向沙场老。\n莫学游侠儿,矜夸紫骝好。", - "type": "五言乐府", - "author": "王昌龄", - "title": "塞上曲" - }, - { - "id": 37, - "contents": "饮马渡秋水,水寒风似刀。\n平沙日未没,黯黯见临洮。\n昔日长城战,咸言意气高。\n黄尘足今古,白骨乱蓬蒿。", - "type": "五言乐府", - "author": "王昌龄", - "title": "塞下曲" - }, - { - "id": 38, - "contents": "明月出天山,苍茫云海间。\n长风几万里,吹度玉门关。\n汉下白登道,胡窥青海湾。\n由来征战地,不见有人还。\n戍客望边色,思归多苦颜。\n高楼当此夜,叹息未应闲。", - "type": "五言乐府", - "author": "李白", - "title": "关山月" - }, - { - "id": 39, - "contents": "秦地罗敷女,采桑绿水边。\n素手青条上,红妆白日鲜。\n蚕饥妾欲去,五马莫留连。", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:春歌" - }, - { - "id": 40, - "contents": "镜湖三百里,菡萏发荷花。\n五月西施采,人看隘若耶。\n回舟不待月,归去越王家。", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:夏歌" - }, - { - "id": 41, - "contents": "长安一片月,万户捣衣声。\n秋风吹不尽,总是玉关情。\n何日平胡虏,良人罢远征?", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:秋歌" - }, - { - "id": 42, - "contents": "明朝驿使发,一夜絮征袍。\n素手抽针冷,那堪把剪刀。\n裁缝寄远道,几日到临洮?", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:冬歌" - }, - { - "id": 43, - "contents": "妾发初覆额,折花门前剧。\n郎骑竹马来,绕床弄青梅。\n同居长干里,两小无嫌猜。\n十四为君妇,羞颜未尝开。\n低头向暗壁,千唤不一回。\n十五始展眉,愿同尘与灰。\n常存抱柱信,岂上望夫台!\n十六君远行,瞿塘滟预堆。\n五月不可触,猿鸣天上哀。\n门前迟行迹,一一生绿苔。\n苔深不能扫,落叶秋风早。\n八月蝴蝶来,双飞西园草。\n感此伤妾心,坐愁红颜老。\n早晚下三巴,预将书报家。\n相迎不道远,直至长风沙。", - "type": "五言乐府", - "author": "李白", - "title": "长干行" - }, - { - "id": 44, - "contents": "梧桐相待老,鸳鸯会双死。\n贞妇贵殉夫,舍生亦如此。\n波澜誓不起,妾心井中水。", - "type": "五言乐府", - "author": "孟郊", - "title": "烈女操" - }, - { - "id": 45, - "contents": "慈母手中线,游子身上衣。\n临行密密缝,意恐迟迟归。\n谁言寸草心,报得三春辉?", - "type": "五言乐府", - "author": "孟郊", - "title": "游子吟" - }, - { - "id": 46, - "contents": "前不见古人,后不见来者。\n念天地之悠悠,独怆然而涕下!", - "type": "五言乐府", - "author": "陈子昂", - "title": "登幽州台歌" - }, - { - "id": 47, - "contents": "男儿事长征,少小幽燕客。\n赌胜马蹄下,由来轻七尺。\n杀人莫敢前,须如猬毛磔。\n黄云陇底白雪飞,未得报恩不能归。\n辽东小妇年十五,惯弹琵琶解歌舞。\n今为羌笛出塞声,使我三军泪如雨!", - "type": "七言古诗", - "author": "李颀", - "title": "古意" - }, - { - "id": 48, - "contents": "四月南风大麦黄,枣花未落桐叶长。\n青山朝别暮还见,嘶马出门思故乡。\n陈侯立身何坦荡,虬须虎眉仍大颡。\n腹中贮书一万卷,不肯低头在草莽。\n东门酤酒饮我曹,心轻万事皆鸿毛。\n醉卧不知白日暮,有时空望孤云高。\n长河浪头连天黑,津口停舟渡不得。\n郑国游人未及家,洛阳行子空叹息。\n闻道故林相识多,罢官昨日今如何?", - "type": "七言古诗", - "author": "李颀", - "title": "送陈章甫" - }, - { - "id": 49, - "contents": "主人有酒欢今夕,请奏鸣琴广陵客。\n月照城头乌半飞,霜凄万树风入衣。\n铜炉华烛烛增辉,初弹渌水后楚妃。\n一声已动物皆静,四座无言星欲稀。\n清淮奉使千馀里,敢告云山从此始?", - "type": "七言古诗", - "author": "李颀", - "title": "琴歌" - }, - { - "id": 50, - "contents": "蔡女昔造胡笳声,一弹一十有八拍。\n胡人落泪沾边草,汉使断肠对归客。\n古戍苍苍烽火寒,大荒沈沈飞雪白。\n先拂声弦后角羽,四郊秋叶惊[扌戚][扌戚]。\n董夫子,通神明,深山窃听来妖精。\n言迟更速皆应手,将往复旋如有情。\n空山百鸟散还合,万里浮云阴且晴。\n嘶酸雏雁失群夜,断绝胡儿恋母声。\n川为静其波,鸟亦罢其鸣。\n乌孙部落家乡远,逻娑沙尘哀怨生。\n幽音变调忽飘洒,长风吹林雨堕瓦。\n迸泉飒飒飞木末,野鹿呦呦走堂下。\n长安城连东掖垣,凤凰池对青琐门。\n高才脱略名与利,日夕望君抱琴至。", - "type": "七言古诗", - "author": "李颀", - "title": "听董大弹胡笳声兼寄语弄房给事" - }, - { - "id": 51, - "contents": "南山截竹为筚篥,此乐本自龟兹出。\n流传汉地曲转奇,凉州胡人为我吹。\n傍邻闻者多叹息,远客思乡皆泪垂。\n世人解听不解赏,长飙风中自来往。\n枯桑老柏寒飕[风留],九雏鸣凤乱啾啾。\n龙吟虎啸一时发,万籁百泉相与秋。\n忽然更作渔阳掺,黄云萧条白日暗。\n变调如闻杨柳春,上林繁花照眼新。\n岁夜高堂列明烛,美酒一杯声一曲。", - "type": "七言古诗", - "author": "李颀", - "title": "听安万善吹筚篥歌" - }, - { - "id": 52, - "contents": "山寺钟鸣昼已昏,渔梁渡头争渡喧。\n人随沙路向江村,余亦乘舟归鹿门。\n鹿门月照开烟树,忽到庞公栖隐处。\n岩扉松径长寂寥,惟有幽人自来去。", - "type": "七言古诗", - "author": "孟浩然", - "title": "夜归鹿门山歌" - }, - { - "id": 53, - "contents": "我本楚狂人,凤歌笑孔丘。\n手持绿玉杖,朝别黄鹤楼。\n五岳寻仙不辞远,一生好入名山游。\n庐山秀出南斗傍,屏风九叠云锦张。\n影落明湖青黛光,金阙前开二峰长。\n银河倒挂三石梁,香炉瀑布遥相望。\n回崖沓障凌苍苍。\n翠影红霞映朝日,鸟飞不到吴天长。\n登高壮观天地间,大江茫茫去不黄。\n黄云万里动风色,白波九道流雪山。\n好为庐山谣,兴因庐山发。\n闲窥石镜清我心,谢公行处苍苔没。\n早服还丹无世情,琴心三叠道初成。\n遥见仙人彩云里,手把芙蓉朝玉京。\n先期汗漫九垓上,愿接卢敖游太清。", - "type": "七言古诗", - "author": "李白", - "title": "庐山谣寄卢侍御虚舟" - }, - { - "id": 54, - "contents": "海客谈瀛洲,烟涛微茫信难求。\n越人语天姥,云霓明灭或可睹。\n天姥连天向天横,势拔五岳掩赤城。\n天台四万八千丈,对此欲倒东南倾。\n我欲因之梦吴越,一夜飞渡镜湖月。\n湖月照我影,送我至剡溪。\n谢公宿处今尚在,渌水荡漾清猿啼。\n脚著谢公屐,身登青云梯。\n半壁见海日,空中闻天鸡。\n千岩万壑路不定,迷花倚石忽已暝。\n熊咆龙吟殷岩泉,栗深林兮惊层巅。\n云青青兮欲雨,水澹澹兮生烟。\n裂缺霹雳,丘峦崩摧。\n洞天石扇,訇然中开。\n青冥浩荡不见底,日月照耀金银台。\n霓为衣兮风为马,云之君兮纷纷而来下。\n虎鼓瑟兮鸾回车,仙之人兮列如麻。\n忽魂悸以魄动,恍惊起而长嗟。\n惟觉时之枕席,失向来之烟霞。\n世间行乐亦如此,古来万事东流水。\n别君去兮何时还?且放白鹿青崖间。\n须行即骑访名山。\n安能摧眉折腰事权贵,使我不得开心颜!", - "type": "七言古诗", - "author": "李白", - "title": "梦游天姥吟留别" - }, - { - "id": 55, - "contents": "风吹柳花满店香,吴姬压酒唤客尝。\n金陵子弟来相送,欲行不行各尽觞。\n请君试问东流水,别意与之谁短长?", - "type": "七言古诗", - "author": "李白", - "title": "金陵酒肆留别" - }, - { - "id": 56, - "contents": "弃我去者,昨日之日不可留。\n乱我心者,今日之日多烦忧!\n长风万里送秋雁,对此可以酣高楼。\n蓬莱文章建安骨,中间小谢又清发。\n俱怀逸兴壮思飞,欲上青天览明月。\n抽刀断水水更流,举杯销愁愁更愁。\n人生在世不称意,明朝散发弄扁舟。", - "type": "七言古诗", - "author": "李白", - "title": "宣州谢[月兆]楼饯别校书叔云" - }, - { - "id": 57, - "contents": "君不见走马川行雪海边,平沙莽莽黄入天。\n轮台九月风夜吼,一川碎石大如斗。\n随风满地石乱走,匈奴草黄马正肥。\n金山西见烟尘飞,汉家大将西出师。\n将军金甲夜不脱,半夜军行戈相拨。\n风头如刀面如割,马毛带雪汗气蒸。\n五花连钱旋作冰,幕中草檄砚水凝。\n虏骑闻之应胆慑,料知短兵不敢接。\n车师西门伫献捷!", - "type": "七言古诗", - "author": "岑参", - "title": "走马川行奉送封大夫出师西征" - }, - { - "id": 58, - "contents": "轮台城头夜吹角,轮台城北旄头落。\n羽书昨夜过渠黎,单于已在金山西。\n戍楼西望烟尘黑,汉兵屯在轮台北。\n上将拥旄西出征,平明吹笛大军行。\n四边伐鼓雪海涌,三军大呼阴山动。\n虏塞兵气连云屯,战场白骨缠草根。\n剑河风急雪片阔,沙口石冻马蹄脱。\n亚相勤王甘苦辛,誓将报主静边尘。\n古来青史谁不见,今见功名胜古人。", - "type": "七言古诗", - "author": "岑参", - "title": "轮台歌奉送封大夫出师西征" - }, - { - "id": 59, - "contents": "北风卷地白草折,胡天八月即飞雪。\n忽如一夜春风来,千树万树梨花开。\n散入珠帘湿罗幕,狐裘不暖锦衾薄。\n将军角弓不得控,都护铁衣冷犹著。\n瀚海阑干百丈冰,愁云黪淡万里凝。\n中军置酒饮归客,胡琴琵琶与羌笛。\n纷纷暮雪下辕门,风掣红旗冻不翻。\n轮台东门送君去,去时雪满天山路。\n山回路转不见君,雪上空留马行处。", - "type": "七言古诗", - "author": "岑参", - "title": "白雪歌送武判官归京" - }, - { - "id": 60, - "contents": "国初以来画鞍马,神妙独数江都王。\n将军得名三十载,人间又见真乘黄。\n曾貌先帝照夜白,龙池十日飞霹雳。\n内府殷红玛瑙盘,婕妤传诏才人索。\n盘赐将军拜舞归,轻纨细绮相追飞。\n贵戚权门得笔迹,始觉屏障生光辉。\n昔日太宗拳毛[马呙],近时郭家狮子花。\n今之新图有二马。复令识者久叹嗟。\n此皆骑战一敌万,缟素漠漠开风沙。\n其余七匹亦殊绝,迥若寒空杂烟雪。\n霜蹄蹴踏长楸间,马官厮养森成列。\n可怜九马争神骏,顾视清高气深稳。\n借问苦心爱者谁,后有韦讽前支盾。\n忆昔巡幸新丰宫,翠花拂天来向东。\n腾骧磊落三万匹,皆与此图筋骨同。\n自从献宝朝河宗,无复射蛟江水中。\n君不见,金粟堆前松柏里。龙媒去尽鸟呼风。", - "type": "七言古诗", - "author": "杜甫", - "title": "韦讽录事宅观曹将军画马图" - }, - { - "id": 61, - "contents": "将军魏武之子孙,于今为庶为青门。\n英雄割据虽已矣,文采风流今尚存。\n学书初学卫夫人,但恨无过王右军。\n丹青不知老将至,富贵于我如浮云。\n开元之中常引见,承恩数上南熏殿。\n凌烟功臣少颜色,将军下笔开生面。\n良相头上进贤冠,猛将腰间大羽箭。\n褒公鄂公毛发动,英姿飒爽犹酣战。\n先帝天马玉花骢,画工如山貌不同。\n是日牵来赤墀下,迥立阊阖生长风。\n诏谓将军拂绢素,意匠惨淡经营中。\n斯须九重真龙出,一洗万古凡马空。\n玉花却在御榻上,榻上庭前屹相向。\n至尊含笑催赐金,圉人太仆皆惆怅。\n弟子韩干早入室,亦能画马穷殊相。\n干惟画肉不画骨,忍使骅骝气凋丧。\n将军画善盖有神,偶逢佳士亦写真。\n即今漂泊干戈际,屡貌寻常行路人。\n涂穷反遭俗眼白,世上未有如公贫。\n但看古来盛名下,终日坎[土禀]缠其身!", - "type": "七言古诗", - "author": "杜甫", - "title": "丹青引赠曹霸将军" - }, - { - "id": 62, - "contents": "今我不乐思岳阳,身欲奋飞病在床。\n美人娟娟隔秋水,濯足洞庭望八荒。\n鸿飞冥冥日月白,青枫叶赤天雨霜。\n玉京群帝集北斗,或骑麒麟翳凤凰。\n芙蓉旌旗烟雾落,影动倒景摇潇湘。\n星宫之君醉琼浆,羽人稀少不在旁。\n似闻昨者赤松子,恐是汉代韩张良。\n昔随刘氏定长安,帷幄未改神惨伤。\n国家成败吾岂敢,色难腥腐餐枫香。\n周南留滞古所惜,南极老人应寿昌。\n美人胡为隔秋水,焉得置之贡玉堂?", - "type": "七言古诗", - "author": "杜甫", - "title": "寄韩谏议" - }, - { - "id": 63, - "contents": "孔明庙前有老柏,柯如青铜根如石。\n双皮溜雨四十围,黛色参天二千尺。\n君臣已与时际会,树木犹为人爱惜。\n云来气接巫峡长,月出寒通雪山白。\n忆昨路绕锦亭东,先主武侯同[门必]宫。\n崔嵬枝干郊原古,窈窕丹青户牖空。\n落落盘踞虽得地,冥冥孤高多烈风。\n扶持自是神明力,正直元因造化功。\n大厦如倾要梁栋,万牛回首丘山重。\n不露文章世已惊,未辞剪伐谁能送?\n苦心岂免容蝼蚁?香叶终经宿鸾凤。\n志士幽人莫怨嗟,古来材大难为用!", - "type": "七言古诗", - "author": "杜甫", - "title": "古柏行" - }, - { - "id": 64, - "contents": "大历二年十月十九日夔府别驾元持宅见临颍李十二娘舞剑器,壮其蔚[足支]。问\n其所师,曰:余公孙大娘弟子也。开元三载,余尚童稚,记于郾城观公孙氏舞剑器\n浑脱。浏漓顿挫,独出冠时。自高头宜春梨园二伎坊内人,洎外供奉,晓是舞者,\n圣文神武皇帝初,公孙一人而已。玉貌锦衣,况余白首!今兹弟子亦匪盛颜。既辨\n其由来,知波澜莫二。抚事慷慨,聊为剑器行。昔者吴人张旭善草书书帖,数尝於\n邺县见公孙大娘舞西河剑器,自此草书长进,豪荡感激。即公孙可知矣!\n昔有佳人公孙氏,一舞剑器动四方。\n观者如山色沮丧,天地为之久低昂。\n霍如羿射九日落,矫如群帝骖龙翔。\n来如雷霆收震怒,罢如江海凝清光。\n绛唇珠袖两寂寞,晚有弟子传芬芳。\n临颍美人在白帝,妙舞此曲神扬扬。\n与余问答既有以,感时抚事增惋伤。\n先帝侍女八千人,公孙剑器初第一。\n五十年间似反掌,风尘[氵项]洞昏王室。\n梨园子弟散如烟,女乐馀姿映寒日。\n金粟堆前木已拱,瞿塘石城草萧瑟。\n玳筵急管曲复终,乐极哀来月东出。\n老夫不知其所往,足茧荒山转愁疾。", - "type": "七言古诗", - "author": "杜甫", - "title": "观公孙大娘弟子舞剑器行并序" - }, - { - "id": 65, - "contents": "漫叟以公田米酿酒,因休暇,则载酒于湖上,\n时取一醉;欢醉中,据湖岸,引臂向鱼取酒,\n使舫载之,遍饮坐者。意疑倚巴丘,酌於君山\n之上,诸子环洞庭而坐,酒舫泛泛然,触波涛\n而往来者,乃作歌以长之。\n石鱼湖,似洞庭,夏水欲满君山青。\n山为樽,水为沼,酒徒历历坐洲鸟。\n长风连日作大浪,不能废人运酒舫。\n我持长瓢坐巴丘,酌饮四座以散愁。", - "type": "七言古诗", - "author": "元结", - "title": "石鱼湖上醉歌并序" - }, - { - "id": 66, - "contents": "山石荦确行径微,黄昏到寺蝙蝠飞。\n升堂坐阶新雨足,芭蕉叶大栀子肥。\n僧言古壁佛画好,以火来照所见稀。\n铺床拂席置羹饭,疏粝亦足饱我饥。\n夜深静卧百虫绝,清月出岭光入扉。\n天明独去无道路,出入高下穷烟霏。\n山红涧碧纷烂漫,时见松枥皆十围。\n当流赤足蹋涧石,水声激激风吹衣。\n人生如此自可乐,岂必局束为人[革几]!\n嗟哉吾党二三子,安得至老不更归!", - "type": "七言古诗", - "author": "韩愈", - "title": "山石" - }, - { - "id": 67, - "contents": "纤云四卷天无河,清风吹空月舒波。\n沙平水息声影绝,一杯相属君当歌。\n君歌声酸辞且苦,不能听终泪如雨。\n洞庭连天九嶷高,蛟龙出没猩鼯号。\n十生九死到官所,幽居默默如藏逃。\n下床畏蛇食畏药,海气湿蛰熏腥臊。\n昨者州前槌大鼓,嗣皇继圣登夔皋。\n赦书一日行万里,罪从大辟皆除死。\n迁者追回流者还,涤瑕荡垢清朝班。\n州家申名使家抑,坎轲只得移荆蛮。\n判司卑官不堪说,未免捶楚尘埃间。\n同时辈流多上道,天路幽险难追攀。\n君歌且休听我歌,我歌今与君殊科。\n一年明月今宵多,人生由命非由他。\n有酒不饮奈明何!", - "type": "七言古诗", - "author": "韩愈", - "title": "八月十五夜赠张功曹" - }, - { - "id": 68, - "contents": "五岳祭秩皆三公,四方环镇嵩当中。\n火维地荒足妖怪,天假神柄专其雄。\n喷云泄雾藏半腹,虽有绝顶谁能穷?\n我来正逢秋雨节,阴气晦昧无清风。\n潜心默祷若有应,岂非正直能感通!\n须臾静扫众峰出,仰见突兀撑青空。\n紫盖连延接天柱,石廪腾掷堆祝融。\n森然魄动下马拜,松柏一迳趋灵宫。\n纷墙丹柱动光彩,鬼物图画填青红。\n升阶伛偻荐脯酒,欲以菲薄明其衷。\n庙内老人识神意,睢盱侦伺能鞠躬。\n手持杯[王交]导我掷,云此最吉馀难同。\n窜逐蛮荒幸不死,衣食才足甘长终。\n侯王将相望久绝,神纵欲福难为功!\n夜投佛寺上高阁,星月掩映云[日童][日龙]。\n猿鸣钟动不知曙,杲杲寒日生于东。", - "type": "七言古诗", - "author": "韩愈", - "title": "谒衡岳庙遂宿岳寺题门楼" - }, - { - "id": 69, - "contents": "张生手持石鼓文,劝我识作石鼓歌。\n少陵无人谪仙死,才薄将奈石鼓何!\n周纲凌迟四海沸,宣王愤起挥天戈。\n大开明堂受朝贺,诸侯剑佩鸣相磨。\n搜于岐阳骋雄俊,万里禽兽皆遮罗。\n镌功勒成告万世,凿石作鼓隳嵯峨。\n从臣才艺咸第一,拣选撰刻留山阿。\n雨淋日炙野火燎,鬼物守护烦[扌为]呵。\n公从何处得纸本?毫发尽备无差讹。\n辞严义密读难晓,字体不类隶与蝌。\n年深岂免有缺画,快剑砍断生蛟鼍。\n鸾翔凤翥众仙下,珊瑚碧树交枝柯。\n金绳铁索锁钮壮,古鼎跃水龙腾梭。\n陋儒编诗不收入,二雅褊迫无委蛇。\n孔子西行不到秦,掎摭星宿遗羲娥。\n嗟予好古生苦晚,对此涕泪双滂沱。\n忆昔初蒙博士征,其年始改称元和。\n故人从军在右辅,为我度量掘臼科。\n濯冠沐浴告祭酒,如此至宝存岂多!\n毡包席裹可立致,十鼓只载数骆驼。\n荐诸太庙比郜鼎,光价岂止百倍过!\n圣恩若许留太学,诸生讲解得切磋。\n观经鸿都尚填咽,坐见举国来奔波。\n剜苔剔藓露节角,安置妥帖平不颇。\n大厦深檐与盖覆,经历久远期无佗。\n中朝大官老于事,讵肯感激徒□(“妍”右上一横改为“合”)婀。\n牧童敲火牛砺角,谁复著手为摩挲?\n日销月铄就埋没,六年西顾空吟哦。\n羲之俗书趁姿媚,数纸尚可博白鹅。\n继周八代争战罢,无人收拾理则那。\n方今太平日无事,柄任儒术崇丘轲。\n安能以此上论列,愿借辩口如悬河。\n石鼓之歌止于此,呜呼吾意其蹉跎!", - "type": "七言古诗", - "author": "韩愈", - "title": "石鼓歌" - }, - { - "id": 70, - "contents": "渔翁夜傍西岩宿,晓汲清湘燃楚烛。\n烟销日出不见人,[矣欠]乃一声山水绿。\n回看天际下中流,岩上无心云相逐。", - "type": "七言古诗", - "author": "柳宗元", - "title": "渔翁" - }, - { - "id": 71, - "contents": "汉皇重色思倾国,御宇多年求不得。\n杨家有女初长成,养在深闺人未识。\n天生丽质难自弃,一朝选在君王侧。\n回眸一笑百媚生,六宫粉黛无颜色。\n春寒赐浴华清池,温泉水滑洗凝脂。\n侍儿扶起娇无力,始是新承恩泽时。\n云鬓花颜金步摇,芙蓉帐暖度春宵。\n春宵苦短日高起,从此君王不早朝。\n承欢侍宴无闲暇,春从春游夜专夜。\n后宫佳丽三千人,三千宠爱在一身。\n金星妆成娇侍夜,玉楼宴罢醉和春。\n姊妹弟兄皆列士,可怜光彩生门户。\n遂令天下父母心,不重生男重生女。\n骊宫高处入青云,仙乐风飘处处闻。\n缓歌慢舞凝丝竹,尽日君王看不足。\n渔阳鼙鼓动地来,惊破霓裳羽衣曲。\n九重城阙烟尘生,千乘万骑西南行。\n翠华摇摇行复止,西出都门百馀里。\n六军不发无奈何,宛转蛾眉马前死。\n花钿委地无人收,翠翘金雀玉搔头。\n君王掩面救不得,回看血泪相和流。\n黄埃散漫风萧索,云栈萦纡登剑阁。\n峨嵋山下少人行,旌旗无光日色薄。\n蜀江水碧蜀山青,圣主朝朝暮暮情。\n行宫见月伤心色,夜雨闻铃肠断声。\n天旋地转回龙驭,到此踌躇不能去。\n马嵬坡下泥土中,不见玉颜空死处。\n君臣相顾尽沾衣,东望都门信马归。\n归来池苑皆依旧,太液芙蓉未央柳。\n芙蓉如面柳如眉,对此如何不泪垂!\n春风桃李花开日,秋雨梧桐叶落时。\n西宫南内多秋草,落叶满阶红不扫。\n梨园子弟白发新,椒房阿监青娥老。\n夕殿萤飞思悄然,孤灯挑尽未成眠。\n迟迟钟鼓初长夜,耿耿星河欲曙天。\n鸳鸯瓦冷霜华重,翡翠衾寒谁与共?\n悠悠生死别经年,魂魄不曾来入梦。\n临邛道士鸿都客,能以精诚致魂魄。\n为感君王辗转思,遂教方士殷勤觅。\n排空驭气奔如电,升天入地求之遍。\n上穷碧落下黄泉,两处茫茫皆不见。\n忽闻海上有仙山,山在虚无缥缈间。\n楼阁玲珑五云起,其中绰约多仙子。\n中有一人字太真,雪肤花貌参差是。\n金阙西厢叩玉扃,转教小玉报双成。\n闻道汉家天子使,九华帐里梦魂惊。\n揽衣推枕起徘徊,珠箔银屏迤逦开。\n云鬓半偏新睡觉,花冠不整下堂来。\n风吹仙袂飘飘举,犹似霓裳羽衣舞。\n玉容寂寞泪阑干,梨花一枝春带雨。\n含情凝睇谢君王,一别音容两渺茫。\n昭阳殿里恩爱绝,蓬莱宫中日月长。\n回头下望人寰处,不见长安见尘雾。\n唯将旧物表深情,钿合金钗寄将去。\n钗留一股合一扇,钗擘黄金合分钿。\n但教心似金钿坚,天上人间会相见。\n临别殷勤重寄词,词中有誓两心知。\n七月七日长生殿,夜半无人私语时。\n在天愿作比翼鸟,在地愿为连理枝。\n天长地久有时尽,此恨绵绵无绝期!", - "type": "七言古诗", - "author": "白居易", - "title": "长恨歌" - }, - { - "id": 72, - "contents": "元和十年,予左迁九江郡司马。明年秋,送客湓浦口,闻船中夜弹琵琶者,听其音\n,铮铮然有京都声;问其人,本长安倡女,尝学琵琶於穆曹二善才。年长色衰,委\n身为贾人妇。遂命酒,使快弹数曲,曲罢悯然。自叙少小时欢乐事,今漂沦憔悴,\n转徙於江湖间。予出官二年恬然自安,感斯人言,是夕,始觉有迁谪意,因为长句\n歌以赠之,凡六百一十六言,命曰琵琶行。\n浔言江头夜送客,枫叶荻花秋瑟瑟。\n主人下马客在船,举酒欲饮无管弦。\n醉不成欢惨将别,别时茫茫江浸月。\n忽闻水上琵琶声,主人忘归客不发。\n寻声暗问弹者谁,琵琶声停欲语迟。\n移船相近邀相见,添酒回灯重开宴。\n千呼万唤始出来,犹抱琵琶半遮面。\n转轴拨弦三两声,未成曲调先有情。\n弦弦掩抑声声思,似诉平生不得志。\n低眉信手续续弹,说尽心中无限事。\n轻拢慢捻抹复挑,初为霓裳后六么。\n大弦嘈嘈如急雨,小弦切切如私语。\n嘈嘈切切错杂弹,大珠小珠落玉盘。\n间关莺语花底滑,幽咽泉流水下滩。\n水泉冷涩弦凝绝,凝绝不通声渐歇。\n别有幽愁暗恨生,此时无声胜有声。\n银瓶乍破水浆迸,铁骑突出刀枪鸣。\n曲终收拨当心画,四弦一声如裂帛。\n东船西舫悄无言,唯见江心秋月白。\n沈吟放拨插弦中,整顿衣裳起敛容。\n自言本是京城女,家在虾蟆陵下住。\n十三学得琵琶成,名属教坊第一部。\n曲罢曾教善才服,妆成每被秋娘妒。\n五陵年少争缠头,一曲红绡不知数。\n钿头银篦击节碎,血色罗裙翻酒污。\n今年欢笑复明年,秋月春风等闲度。\n弟走从军阿姨死,暮去朝来颜色故。\n门前冷落车马稀,老大嫁作商人妇。\n商人重利轻别离,前月浮梁买茶去。\n去来江口守空船,绕船月明江水寒。\n夜深忽梦少年事,梦啼妆泪红阑干。\n我闻琵琶已叹息,又闻此语重唧唧。\n同是天涯沦落人,相逢何必曾相识!\n我从去年辞帝京,谪居卧病浔阳城。\n浔阳地僻无音乐,终岁不闻丝竹声。\n住近湓江地低湿,黄芦苦竹绕宅生。\n其间旦暮闻何物?杜鹃啼血猿哀鸣。\n春江花朝秋月夜,往往取酒还独倾。\n岂无山歌与村笛,呕哑嘲哳难为听!\n今夜闻君琵琶语,如听仙乐耳暂明。\n莫辞更坐弹一曲,为君翻作琵琶行。\n感我此言良久立,却坐促弦弦转急。\n凄凄不似向前声,满座重闻皆掩泣。\n座中泣下谁最多,江州司马青衫湿!", - "type": "七言古诗", - "author": "白居易", - "title": "琵琶行并序" - }, - { - "id": 73, - "contents": "元和天子神武姿,彼何人哉轩与羲。\n誓将上雪列圣耻,坐法宫中朝四夷。\n淮西有贼五十载,封狼生[豸区][豸区]生罴。\n不据山河据平地,长戈利矛日可麾。\n帝得圣相相曰度,贼斫不死神扶持。\n腰悬相印作都统,阴风惨澹天王旗。\n□(上朔下心]武古通作牙爪,仪曹外郎载笔随。\n行军司马智且勇,十四万众犹虎貔。\n入蔡缚贼献太庙,功无与让恩不訾。\n帝曰汝度功第一,汝从事愈宜为辞。\n愈拜稽首蹈且舞,金石刻画臣能为。\n古者世称大手笔,此事不系于职司。\n当仁自古有不让,言讫屡颔天子颐。\n公退斋戒坐小阁,濡染大笔何淋漓!\n点窜尧典舜典字,涂改清庙生民诗。\n文成破体书在纸,清晨再拜铺丹墀。\n表曰臣愈昧死上,咏神圣功书之碑。\n碑高三丈字如斗,负以灵鳌蟠以螭。\n句奇语重喻者少,谗之天子言其私。\n长绳百尺拽碑倒,粗沙大石相磨治。\n公之斯文若元气,先时已入人肝脾。\n汤盘孔鼎有述作,今无其器存其辞。\n呜呼圣皇及圣相,相与[火亘]赫流淳熙。\n公之斯文不示后,曷与三五相攀追。\n愿书万本诵万过,口角流沫右手胝。\n传之七十有二代,以为封禅玉检明堂基。", - "type": "七言古诗", - "author": "李商隐", - "title": "韩碑" - }, - { - "id": 74, - "contents": "开元二十六年,客有从御史大夫张公出塞而还者,作燕歌行以示适,感征戍之事,\n因而和焉。\n汉家烟尘在东北,汉将辞家破残贼。\n男儿本自重横行,天子非常赐颜色。\n[扌从]金伐鼓下榆关,旌旆逶迤碣石间。\n校尉羽书飞瀚海,单于猎火照狼山。\n山川萧条极边土,胡骑凭陵杂风雨。\n战士军前半死生,美人帐下犹歌舞。\n大漠穷秋塞草衰,孤城落日斗兵稀。\n身当恩遇常轻敌,力尽关山未解围。\n铁衣远戍辛勤久,玉筋应啼别离后。\n少妇城南欲断肠,征人蓟北空回首。\n边庭飘摇那可度,绝域苍茫更何有!\n杀气三时作阵云,寒声一夜传刁斗。\n相看白刃血纷纷,死节从来岂顾勋?\n君不见沙场征战苦,至今犹忆李将军!", - "type": "七言乐府", - "author": "高适", - "title": "燕歌行并序" - }, - { - "id": 75, - "contents": "白日登山望烽火,黄昏饮马傍交河。\n行人刁斗风沙暗,公主琵琶幽怨多。\n野云万里无城郭,雨雪纷纷连大漠。\n胡雁哀鸣夜夜飞,胡儿眼泪双双落。\n闻道玉门犹被遮,应将性命逐轻车。\n年年战骨埋荒外,空见葡萄入汉家。", - "type": "七言乐府", - "author": "李颀", - "title": "古从军行" - }, - { - "id": 76, - "contents": "洛阳女儿对门居,才可容颜十五馀。\n良人玉勒乘骢马,侍女金盘脍鲤鱼。\n画阁朱楼尽相望,红桃绿柳垂檐向。\n罗帷送上七香车,宝扇迎归九华帐。\n狂夫富贵在青春,意气骄奢剧季伦。\n自怜碧玉亲教舞,不惜珊瑚持与人。\n春窗曙灭九微火,九微片片飞花琐。\n戏罢曾无理曲时,妆成只是薰香坐。\n城中相识尽繁华,日夜经过赵李家。\n谁怜越女颜如玉,贫贱江头自浣纱!", - "type": "七言乐府", - "author": "王维", - "title": "洛阳女儿行" - }, - { - "id": 77, - "contents": "少年十五二十时,步行夺得胡马骑。\n射杀山中白额虎,肯数邺下黄须儿!\n一身转战三千里,一剑曾当百万师。\n汉兵奋迅如霹雳,虏骑崩腾畏蒺藜。\n卫青不败由天幸,李广无功缘数奇。\n自从弃置便衰朽,世事蹉跎成白首。\n昔时飞箭无全目,今日垂杨生左肘。\n路旁时卖故侯瓜,门前学种先生柳。\n苍茫古木连穷巷,寥落寒山对虚牖。\n誓令疏勒出飞泉,不似颍川空使酒。\n贺兰山下阵如云,羽檄交驰日夕闻。\n节使三河募年少,诏书五道出将军。\n试拂铁衣如雪色,聊持宝剑动星文。\n愿得燕弓射大将,耻令越甲鸣吾君。\n莫嫌旧日云中守,犹堪一战取功勋!", - "type": "七言乐府", - "author": "王维", - "title": "老将行" - }, - { - "id": 78, - "contents": "渔舟逐水爱山春,两岸桃花夹古津。\n坐看红树不知远,行尽青溪不见人。\n山口潜行始隈[阝奥],山开旷望旋平陆。\n遥看一处攒云树,近入千家散花竹。\n樵客初传汉姓名,居人未改秦衣服。\n居人共住武陵源,还从物外起田园。\n月明松下房栊静,日出云中鸡犬喧。\n惊闻俗客争来集,竞引还家问都邑。\n平明闾巷扫花开,薄暮渔樵乘水入。\n初因避地去人间,及至成仙遂不还。\n峡里谁知有人事?世中遥望空云山。\n不疑灵境难闻见,尘心未尽思乡县。\n出洞无论隔山水,辞家终拟长游衍。\n自谓经过旧不迷,安知峰壑今来变?\n当时只记入山深,青溪几曲到云林。\n春来遍是桃花水,不辨仙源何处寻。", - "type": "七言乐府", - "author": "王维", - "title": "桃源行" - }, - { - "id": 79, - "contents": "噫吁戏,危乎高哉!\n蜀道之难难于上青天!\n蚕丛及鱼凫,开国何茫然!\n尔来四万八千岁,始与秦塞通人烟。\n西当太白有鸟道,可以横绝峨眉巅。\n地崩山摧壮士死,然后天梯石栈方钩连。\n上有六龙回日之高标,下有冲波逆折之回川。\n黄鹤之飞尚不得,猿猱欲度愁攀援。\n青泥何盘盘,百步九折萦岩峦。\n扪参历井仰胁息,以手抚膺坐长叹。\n问君西游何时还?畏途□(繁体“谗”换山旁)岩不可攀!\n但见悲鸟号古木,雄飞雌从绕林间。\n又闻子规啼,夜月愁空山。\n蜀道之难难于上青天!使人听此凋朱颜。\n连峰去天不盈尺,枯松倒挂倚绝壁。\n飞湍瀑流争喧[兀豕],冰崖转石万壑雷。\n其险也如此!\n嗟尔远道之人,胡为乎来哉?\n剑阁峥嵘而崔嵬。\n一夫当关,万夫莫开。\n所守或匪亲,化为狼与豺。\n朝避猛虎,夕避长蛇。\n磨牙吮血,杀人如麻。\n锦城虽云乐,不如早还家。\n蜀道之难难于上青天!侧身西望常咨嗟!", - "type": "七言乐府", - "author": "李白", - "title": "蜀道难" - }, - { - "id": 80, - "contents": "长相思,在长安。\n络纬秋啼金井阑,微霜凄凄簟色寒。\n孤灯不明思欲绝,卷帷望月空长叹。\n美人如花隔云端。\n上有青冥之长天,下有渌水之波澜。\n天长路远魂飞苦,梦魂不到关山难。\n长相思,摧心肝!", - "type": "七言乐府", - "author": "李白", - "title": "长相思二首之一" - }, - { - "id": 81, - "contents": "日色已尽花含烟,月明欲素愁不眠。\n赵瑟初停凤凰柱,蜀琴欲奏鸳鸯弦。\n此曲有意无人传,愿随春风寄燕然。\n忆君迢迢隔青天。\n昔日横波目,今成流泪泉。\n不信妾肠断,归来看取明镜前。", - "type": "七言乐府", - "author": "李白", - "title": "长相思二首之二" - }, - { - "id": 82, - "contents": "金樽清酒斗十千,玉盘珍羞值万钱。\n停杯投箸不能食,拔剑四顾心茫然。\n欲渡黄河冰塞川,将登太行雪满山。\n闲来垂钓碧溪上,忽复乘舟梦日边。\n行路难,行路难!多歧路,今安在?\n长风破浪会有时,直挂云帆济沧海。", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之一" - }, - { - "id": 83, - "contents": "大道如青天,我独不得出。\n羞逐长安社中儿,赤鸡白狗赌梨栗。\n弹剑作歌奏苦声,曳裾王门不称情。\n淮阴市井笑韩信,汉朝公卿忌贾生。\n君不见,昔时燕家重郭隗,拥彗折节无嫌猜\n剧辛乐毅感恩分,输肝剖胆效英才。\n昭王白骨萦蔓草,谁人更扫黄金台?\n行路难,归去来!", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之二" - }, - { - "id": 84, - "contents": "有耳莫洗颍川水,有口莫食首阳蕨。\n含光混世贵无名,何用孤高比云月?\n吾观自古贤达人,功成不退皆殒身。\n子胥既弃吴江上,屈原终投湘水滨。\n陆机雄才岂自保?李斯税驾苦不早。\n华亭鹤唳讵可闻,上蔡苍鹰何足道!\n君不见,吴中张翰称达生,秋风忽忆江东行。\n且乐生前一杯酒,何须身后千载名!", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之三" - }, - { - "id": 85, - "contents": "君不见,黄河之水天上来,奔流到海不复回。\n君不见,高堂明镜悲白发,朝如青丝暮成雪。\n人生得意须尽欢,莫使金樽空对月!\n天生我材必有用,千金散尽还复来。\n烹羊宰牛且为乐,会须一饮三百杯!\n岑夫子,丹丘生,将进酒,君莫停!\n与君歌一曲,请君为我侧耳听!\n钟鼓馔玉不足贵,但愿长醉不愿醒!\n古来圣贤皆寂寞,惟有饮者留其名!\n陈王昔时宴平乐,斗酒十千恣欢谑。\n主人何为言少钱?径须沽取对君酌。\n五花马,千金裘,呼儿将出换美酒,与尔同消万古愁!", - "type": "七言乐府", - "author": "李白", - "title": "将进酒" - }, - { - "id": 86, - "contents": "车辚辚,马萧萧,行人弓箭各在腰。\n耶娘妻子走相送,尘埃不见咸阳桥。\n牵衣顿足拦道哭,哭声直上干云霄!\n道旁过者问行人,行人但云点行频。\n或从十五北防河,便至四十西营田。\n去时里正与裹头,归来头白还戍边!\n边亭流血成海水,武皇开边意未已。\n君不闻,汉家山东二百州,千村万落生荆杞!\n纵有健妇把锄犁,禾生陇亩无东西。\n况复秦兵耐苦战,被驱不异犬与鸡。\n长者虽有问,役夫敢申恨?\n且如今年冬,未休关西卒。\n县官急索租,租税从何出?\n信知生男恶,反是生女好。\n生女犹得嫁比邻,生男埋没随百草!\n君不见,青海头,古来白骨无人收。\n新鬼烦冤旧鬼哭,天阴雨湿声啾啾!", - "type": "七言乐府", - "author": "杜甫", - "title": "兵车行" - }, - { - "id": 87, - "contents": "三月三日天气新,长安水边多丽人。\n态浓意远淑且真,肌理细腻骨肉匀。\n绣罗衣裳照暮春,蹙金孔雀银麒麟。\n头上何所有?翠微盍叶垂鬓唇。\n背后何所见?珠压腰[衤及]稳称身。\n就中云幕椒房亲,赐名大国虢与秦。\n紫驼之峰出翠釜,水精之盘行素鳞。\n犀箸餍饫久未下,鸾刀缕切空纷纶。\n黄门飞[革空]不动尘,御厨络绎送八珍。\n箫鼓哀吟感鬼神,宾从杂沓实要津。\n后来鞍马何逡巡,当轩下马入锦茵。\n杨花雪落覆白苹,青鸟飞去衔红巾。\n炙手可热势绝伦,慎莫近前丞相嗔!", - "type": "七言乐府", - "author": "杜甫", - "title": "丽人行" - }, - { - "id": 88, - "contents": "少陵野老吞生哭,春日潜行曲江曲。\n江头宫殿锁千门,细柳新蒲为谁绿?\n忆昔霓旌下南苑,苑中景物生颜色。\n昭阳殿里第一人,同辇随君侍君侧。\n辇前才人带弓箭,白马嚼啮黄金勒。\n翻身向天仰射云,一箭正坠双飞翼。\n明眸皓齿今何在?血污游魂归不得!\n清渭东流剑阁深,去住彼此无消息。\n人生有情泪沾臆,江水江花岂终极?\n黄昏胡骑尘满城,欲往城南望城北。", - "type": "七言乐府", - "author": "杜甫", - "title": "哀江头" - }, - { - "id": 89, - "contents": "长安城头头白乌,夜飞延秋门上呼。\n又向人家啄大屋,屋底达官走避胡。\n金鞭断折九马死,骨肉不待同驰驱。\n腰下宝[“决”换王旁]青珊瑚,可怜王孙泣路隅!\n问之不肯道姓名,但道困苦乞为奴。\n已经百日窜荆棘,身上无有完肌肤。\n高帝子孙尽隆准,龙种自与常人殊。\n豺狼在邑龙在野,王孙善保千金躯。\n不敢长语临交衢,且为王孙立斯须。\n昨夜东风吹血腥,东来橐驼满旧都。\n朔方健儿好身手,昔何勇锐今何愚!\n窃闻天子已传位,圣德北服南单于。\n花门□(“嫠”下女换刀)面请雪耻,慎勿出口他人狙!\n哀哉王孙慎勿疏,五陵佳气无时无。", - "type": "五言律诗", - "author": "杜甫", - "title": "哀王孙" - }, - { - "id": 90, - "contents": "夫子何为者,栖栖一代中。\n地犹鄹氏邑,宅即鲁王宫。\n叹凤嗟身否?伤麟怨道穷。\n今看两楹奠,当与梦时同。", - "type": "五言律诗", - "author": "唐玄宗", - "title": "经邹鲁祭孔子而叹之" - }, - { - "id": 91, - "contents": "海上生明月,天涯共此时。\n情人怨遥夜,竟夕起相思!\n灭烛怜光满,披衣觉露滋。\n不堪盈手赠,还寝梦佳期。", - "type": "五言律诗", - "author": "张九龄", - "title": "望月怀远" - }, - { - "id": 92, - "contents": "城阙辅三秦,风烟望五津。\n与君离别意,同是宦游人。\n海内存知己,天涯若比邻。\n无为在歧路,儿女共沾巾。", - "type": "五言律诗", - "author": "王勃", - "title": "送杜少府之任蜀州" - }, - { - "id": 93, - "contents": "余禁所禁垣西,是法厅事也。有古槐数株焉,虽生意可知,同殷仲文之古树,而听\n讼斯在,即周召伯之甘棠。每至夕照低阴,秋蝉疏引,发声幽息,有切尝闻;岂人\n心异於曩时,将虫响悲於前听?嗟乎!声以动容,德以象贤,故洁其身也,禀君子\n达人之高行;蜕其皮也,有仙都羽化之灵姿。候时而来,顺阴阳之数;应节为变,\n审藏用之机。有目斯开,不以道昏而昧其视;有翼自薄,不以俗厚而易其真。吟乔\n树之微风,韵资天纵;饮高秋之坠露,清畏人知。仆失路艰虞,遭时徽[纟墨],\n不哀伤而自怨,未摇落而先衰。闻蟪蛄之流声,悟平反之已奏;见螳螂之抱影,怯\n危机之未安。感而缀诗,贻诸知己。庶情沿物应,哀弱羽之飘零;道寄人知,悯馀\n声之寂寞。非谓文墨,取代幽忧云尔。\n西路蝉声唱,南冠客思侵。\n那堪玄鬓影,来对白头吟!\n露重飞难进,风多响易沉。\n无人信高洁,谁为表予心?", - "type": "五言律诗", - "author": "骆宾王", - "title": "在狱咏蝉并序" - }, - { - "id": 94, - "contents": "独有宦游人,偏惊物候新。\n云霞出海曙,梅柳渡江春。\n淑气催黄鸟,晴光转绿苹。\n忽闻歌古调,归思欲沾巾。", - "type": "五言律诗", - "author": "杜审言", - "title": "和晋陵路丞早春游望" - }, - { - "id": 95, - "contents": "闻道黄龙戍,频年不解兵。\n可怜闺里月,长在汉家营。\n少妇今春意,良人昨夜情。\n谁能将旗鼓,一为取龙城?", - "type": "五言律诗", - "author": "沈全期", - "title": "杂诗" - }, - { - "id": 96, - "contents": "阳月南飞雁,传闻至此回。\n我行殊未已,何日复归来?\n江静潮初落,林昏瘴不开。\n明朝望乡处,应见陇头梅。", - "type": "五言律诗", - "author": "宋之问", - "title": "题大庾岭北驿" - }, - { - "id": 97, - "contents": "客路青山外,行舟绿水前。\n潮平两岸阔,风正一帆悬。\n海日生残夜,江春入旧年。\n乡书何处达?归雁洛阳边。", - "type": "五言律诗", - "author": "王湾", - "title": "次北固山下" - }, - { - "id": 98, - "contents": "清晨入古寺,初日照高林。\n曲径通幽处,禅房花木深。\n山光悦鸟性,潭影空人心。\n万籁此俱寂,惟馀钟磬音。", - "type": "五言律诗", - "author": "常建", - "title": "题破山寺后禅院" - }, - { - "id": 99, - "contents": "联步趋丹陛,分曹限紫微。\n晓随天仗入,暮惹御香归。\n白发悲花落,青云羡鸟飞。\n圣朝无阙事,自觉谏书稀。", - "type": "五言律诗", - "author": "岑参", - "title": "寄左省杜拾遗" - }, - { - "id": 100, - "contents": "吾爱孟夫子,风流天下闻。\n红颜弃轩冕,白首卧松云。\n醉月频中圣,迷花不事君。\n高山安可仰,徒此挹清芬。", - "type": "五言律诗", - "author": "李白", - "title": "赠孟浩然" - }, - { - "id": 101, - "contents": "渡远荆门外,来从楚国游。\n山随平野尽,江入大荒流。\n月下飞天镜,云生结海楼。\n仍怜故乡水,万里送行舟。", - "type": "五言律诗", - "author": "李白", - "title": "渡荆门送别" - }, - { - "id": 102, - "contents": "青山横北郭,白水绕东城。\n此地一为别,孤蓬万里征。\n浮云游子意,落日故人情。\n挥手自兹去,萧萧班马鸣。", - "type": "五言律诗", - "author": "李白", - "title": "送友人" - }, - { - "id": 103, - "contents": "蜀僧抱绿绮,西下峨眉峰。\n为我一挥手,如听万壑松。\n客心洗流水,馀响入霜钟。\n不觉碧山暮,秋云暗几重。", - "type": "五言律诗", - "author": "李白", - "title": "听蜀僧浚弹琴" - }, - { - "id": 104, - "contents": "牛渚西江夜,青天无片云。\n登舟望秋月,空忆谢将军。\n余亦能高咏,斯人不可闻。\n明朝挂帆席,枫叶落纷纷。", - "type": "五言律诗", - "author": "李白", - "title": "夜泊牛渚怀古" - }, - { - "id": 105, - "contents": "今夜[鹿阝]州月,闺中只独看。\n遥怜小儿女,未解忆长安。\n香雾云鬟湿,清辉玉臂寒。\n何时倚虚幌,双照泪痕干?", - "type": "五言律诗", - "author": "杜甫", - "title": "月夜" - }, - { - "id": 106, - "contents": "国破山河在,城春草木深。\n感时花溅泪,恨别鸟惊心。\n烽火连三月,家书抵万金。\n白头搔更短,浑欲不胜簪。", - "type": "五言律诗", - "author": "杜甫", - "title": "春望" - }, - { - "id": 107, - "contents": "花隐掖垣暮,啾啾栖鸟过。\n星临万户动,月傍九霄多。\n不寝听金钥,因风想玉珂。\n明朝有封事,数问夜如何?", - "type": "五言律诗", - "author": "杜甫", - "title": "春宿左省" - }, - { - "id": 108, - "contents": "此道昔归顺,西郊胡正繁。\n至今残破胆,应有未招魂。\n近得归京邑,移官岂至尊?\n无才日衰老,驻马望千门。", - "type": "五言律诗", - "author": "杜甫", - "title": "至德二载甫自京金光门出,问道归凤翔。乾元初从左拾遗移华州掾。与亲故别,因出此门。有悲往事。" - }, - { - "id": 109, - "contents": "戍鼓断人行,秋边一雁声。\n露从今夜白,月是故乡明。\n有弟皆分散,无家问死生。\n寄书长不达,况乃未休兵。", - "type": "五言律诗", - "author": "杜甫", - "title": "月夜忆舍弟" - }, - { - "id": 110, - "contents": "凉风起天末,君子意如何?\n鸿雁几时到,江湖秋水多。\n文章憎命达,魑魅喜人过。\n应共冤魂语,投诗赠汨罗。", - "type": "五言律诗", - "author": "杜甫", - "title": "天末怀李白" - }, - { - "id": 111, - "contents": "远送从此别,青山空复情。\n几时杯重把,昨夜月同行。\n列郡讴歌惜,三朝出入荣。\n将村独归处,寂寞养残生。", - "type": "五言律诗", - "author": "杜甫", - "title": "奉济驿重送严公四韵" - }, - { - "id": 112, - "contents": "他乡复行役,驻马别孤坟。\n近泪无干土,低空有断云。\n对棋陪谢傅,把剑觅徐君。\n唯见林花落,莺啼送客闻。", - "type": "五言律诗", - "author": "杜甫", - "title": "别房太尉墓" - }, - { - "id": 113, - "contents": "细草微风岸,危樯独夜舟。\n星垂平野阔,月涌大江流。\n名岂文章著?官应老病休。\n飘飘何所似,天地一沙鸥。", - "type": "五言律诗", - "author": "杜甫", - "title": "旅夜书怀" - }, - { - "id": 114, - "contents": "昔闻洞庭水,今上岳阳楼。\n吴楚东南坼,乾坤日夜浮。\n亲朋无一字,老病有孤舟。\n戎马关山北,凭轩涕泗流。", - "type": "五言律诗", - "author": "杜甫", - "title": "登岳阳楼" - }, - { - "id": 115, - "contents": "寒山转苍翠,秋水日潺[氵爰]。\n倚杖柴门外,临风听暮蝉。\n渡头馀落日,墟里上孤烟。\n复值接舆醉,狂歌五柳前。", - "type": "五言律诗", - "author": "王维", - "title": "辋川闲居赠裴秀才迪" - }, - { - "id": 116, - "contents": "空山新雨后,天气晚来秋。\n明月松间照,清泉石上流。\n竹喧归浣女,莲动下渔舟。\n随意春芳歇,王孙自可留。", - "type": "五言律诗", - "author": "王维", - "title": "山居秋暝" - }, - { - "id": 117, - "contents": "清川带长薄,车马去闲闲。\n流水如有意,暮禽相与还。\n荒城临古渡,落日满秋山。\n迢递嵩高下,归来且闭关。", - "type": "五言律诗", - "author": "王维", - "title": "归嵩山作" - }, - { - "id": 118, - "contents": "太乙近天都,连山接海隅。\n白云回望合,青霭入看无。\n分野中峰变,阴晴众壑殊。\n欲投人处宿,隔水问樵夫。", - "type": "五言律诗", - "author": "王维", - "title": "终南山" - }, - { - "id": 119, - "contents": "晚年惟好静,万事不关心。\n自顾无长策,空知返旧林。\n松风吹解带,山月照弹琴。\n君问穷通理,渔歌入浦深。", - "type": "五言律诗", - "author": "王维", - "title": "酬张少府" - }, - { - "id": 120, - "contents": "不知香积寺,数里入云峰。\n古木无人径,深山何处钟?\n泉声咽危石,日色冷青松。\n薄暮空潭曲,安禅制毒龙。", - "type": "五言律诗", - "author": "王维", - "title": "过香积寺" - }, - { - "id": 121, - "contents": "万壑树参天,千山响杜鹃。\n山中一夜雨,树杪百重泉。\n汉女输[木童]布,巴人讼芋田。\n文翁翻教授,不敢倚先贤。", - "type": "五言律诗", - "author": "王维", - "title": "送梓州李使君" - }, - { - "id": 122, - "contents": "楚塞三湘接,荆门九派通。\n江流天地外,山色有无中。\n郡邑浮前浦,波澜动远空。\n襄阳好风日,留醉与山翁。", - "type": "五言律诗", - "author": "王维", - "title": "汉江临眺" - }, - { - "id": 123, - "contents": "中岁颇好道,晚家南山陲。\n兴来美独往,胜事空自知。\n行到水穷处,坐看云起时。\n偶然值林叟,谈笑无还期。", - "type": "五言律诗", - "author": "王维", - "title": "终南别业" - }, - { - "id": 124, - "contents": "八月湖水平,涵虚混太清。\n气蒸云梦泽,波撼岳阳城。\n欲济无舟楫,端居耻圣明。\n坐观垂钓者,空有羡鱼情。", - "type": "五言律诗", - "author": "孟浩然", - "title": "望洞庭湖赠张丞相" - }, - { - "id": 125, - "contents": "人事有代谢,往来成古今。\n江山留胜迹,我辈复登临。\n水落鱼梁浅,天寒梦泽深。\n羊公碑字在,读罢泪沾襟。", - "type": "五言律诗", - "author": "孟浩然", - "title": "与诸子登岘山" - }, - { - "id": 126, - "contents": "林卧愁春尽,开轩览物华。\n忽逢青鸟使,邀入赤松家。\n丹灶初开火,仙桃正发花。\n童颜若可驻,何惜醉流霞!", - "type": "五言律诗", - "author": "孟浩然", - "title": "清明日宴梅道士房" - }, - { - "id": 127, - "contents": "北阙休上书,南山归敝庐。\n不才明主弃,多病故人疏。\n白发催年老,青阳逼岁除。\n永怀愁不寐,松月夜窗墟。", - "type": "五言律诗", - "author": "孟浩然", - "title": "岁暮归南山" - }, - { - "id": 128, - "contents": "故人具鸡黍,邀我至田家。\n绿树村边合,青山郭外斜。\n开轩面场圃,把酒话桑麻。\n待到重阳日,还来就菊花。", - "type": "五言律诗", - "author": "孟浩然", - "title": "过故人庄" - }, - { - "id": 129, - "contents": "一丘尝欲卧,三径苦无资。\n北土非吾愿,东林怀我师。\n黄金燃桂尽,壮志逐年衰。\n日夕凉风至,闻蝉但益悲。", - "type": "五言律诗", - "author": "孟浩然", - "title": "秦中感秋寄远上人" - }, - { - "id": 130, - "contents": "山暝听猿愁,沧江急夜流。\n风鸣两岸叶,月照一孤舟。\n建德非吾土,维扬忆旧游。\n还将两行泪,遥寄海西头。", - "type": "五言律诗", - "author": "孟浩然", - "title": "宿桐庐江寄广陵旧游" - }, - { - "id": 131, - "contents": "寂寂竟何待,朝朝空自归。\n欲寻芳草去,惜与故人违。\n当路谁相假,知音世所稀。\n只应守寂寞,还掩故园扉。", - "type": "五言律诗", - "author": "孟浩然", - "title": "留别王侍御维" - }, - { - "id": 132, - "contents": "木落雁南渡,北风江上寒。\n我家襄水曲,遥隔楚云端。\n乡泪客中尽,孤帆天际看。\n迷津欲有问,平海夕漫漫。", - "type": "五言律诗", - "author": "孟浩然", - "title": "早寒江上有怀" - }, - { - "id": 133, - "contents": "古台摇落后,秋日望乡心。\n野寺人来少,云峰水隔深。\n夕阳依旧垒,寒磬满空林。\n惆怅南朝事,长江独至今。", - "type": "五言律诗", - "author": "刘长卿", - "title": "秋日登吴公台上寺远眺" - }, - { - "id": 134, - "contents": "流落征南将,曾驱十万师。\n罢归无旧业,老去恋明时。\n独立三边静,轻生一剑知。\n茫茫江汉上,日暮复何之。", - "type": "五言律诗", - "author": "刘常卿", - "title": "送李中丞归汉阳别业" - }, - { - "id": 135, - "contents": "望君烟水阔,挥手泪沾巾。\n飞鸟没何处,青山空向人。\n长江一帆远,落日五湖春。\n谁见汀洲上,相思愁白苹?", - "type": "五言律诗", - "author": "刘长卿", - "title": "饯别王十一南游" - }, - { - "id": 136, - "contents": "一路经行处,莓苔见履痕。\n白云依静渚,春草闭闲门。\n过雨看松色,随山到水源。\n溪花与禅意,相对亦忘言。", - "type": "五言律诗", - "author": "刘长卿", - "title": "寻南溪常山道人隐居" - }, - { - "id": 137, - "contents": "乡心新岁切,天畔独潸然。\n老至居人下,春归在客先。\n岭猿同旦暮,江柳共风烟。\n已似长沙傅,从今又几年?", - "type": "五言律诗", - "author": "刘长卿", - "title": "新年作" - }, - { - "id": 138, - "contents": "上国随缘住,来途若梦行。\n浮天沧海远,去世法舟轻。\n水月通禅寂,鱼龙听梵声。\n惟怜一灯影,万里眼中明。", - "type": "五言律诗", - "author": "钱起", - "title": "送僧归日本" - }, - { - "id": 139, - "contents": "泉壑带茅茨,云霞生薜帷。\n竹怜新雨后,山爱夕阳时。\n闲鹭栖常早,秋花落更迟。\n家童扫萝径,昨与故人期。", - "type": "五言律诗", - "author": "钱起", - "title": "谷口书斋寄杨补阙" - }, - { - "id": 140, - "contents": "江汉曾为客,相逢每醉还。\n浮云一别后,流水十年间。\n欢笑情如旧,萧疏鬓已斑。\n何因北归去,淮上对秋山。", - "type": "五言律诗", - "author": "韦应物", - "title": "淮上喜会梁川故人" - }, - { - "id": 141, - "contents": "楚江微雨里,建业暮钟时。\n漠漠帆来重,冥冥鸟去迟。\n海门深不见,浦树远含滋。\n相送情无限,沾襟比散丝。", - "type": "五言律诗", - "author": "韦应物", - "title": "赋得暮雨送李胄" - }, - { - "id": 142, - "contents": "长簟迎风早,空城澹月华。\n星河秋一雁,砧杵夜千家。\n节候看应晚,心期卧亦赊。\n向来吟秀句,不觉已鸣鸦。", - "type": "五言律诗", - "author": "韩□(“雄”右半换“羽”)", - "title": "酬程延秋夜即事见赠" - }, - { - "id": 143, - "contents": "道由白云尽,春与青溪长。\n时有落花至,远隋流水香。\n闲门向山路,深柳读书堂。\n幽映每白日,清辉照衣裳。", - "type": "五言律诗", - "author": "刘脊虚", - "title": "阙题" - }, - { - "id": 144, - "contents": "天秋月又满,城阙夜千重。\n还作江南会,翻疑梦里逢。\n风枝惊暗鹊,露草覆寒虫。\n羁旅长堪醉,相留畏晓钟。", - "type": "五言律诗", - "author": "戴叔伦", - "title": "江乡故人偶集客舍" - }, - { - "id": 145, - "contents": "故关衰草遍,离别正堪悲!\n路出寒云外,人归暮雪时。\n少孤为客早,多难识君迟。\n掩泪空相向,风尘何处期?", - "type": "五言律诗", - "author": "卢纶", - "title": "李端公" - }, - { - "id": 146, - "contents": "十年离乱后,长大一相逢。\n问姓惊初见,称名忆旧容。\n别来沧海事,语罢暮天钟。\n明日巴陵道,秋山又几重。", - "type": "五言律诗", - "author": "李益", - "title": "喜见外弟又言别" - }, - { - "id": 147, - "contents": "故人江海别,几度隔山川。\n乍见翻疑梦,相悲各问年。\n孤灯寒照雨,深竹暗浮烟。\n更有明朝恨,离杯惜共传。", - "type": "五言律诗", - "author": "司空曙", - "title": "云阳馆与韩绅宿别" - }, - { - "id": 148, - "contents": "静夜四无邻,荒居旧业贫。\n雨中黄叶树,灯下白头人。\n以我独沉久,愧君相访频。\n平生自有分,况是蔡家亲!", - "type": "五言律诗", - "author": "司空曙", - "title": "喜外弟卢纶见宿" - }, - { - "id": 149, - "contents": "世乱同南去,时清独北还。\n他乡生白发,旧国见青山。\n晓月过残垒,繁星宿故关。\n寒禽与衰草,处处伴愁颜。", - "type": "五言律诗", - "author": "司空曙", - "title": "贼平后送人北归" - }, - { - "id": 150, - "contents": "天地英雄气,千秋尚凛然!\n势分三足鼎,业复五铢钱。\n得相能开国,生儿不象贤。\n凄凉蜀故妓,来舞魏宫前。", - "type": "五言律诗", - "author": "刘禹锡", - "title": "蜀先主庙" - }, - { - "id": 151, - "contents": "前年伐月支,城下没全师。\n蕃汉断消息,死生长别离。\n无人收废帐,归马识残旗。\n欲祭疑君在,天涯哭此时。", - "type": "五言律诗", - "author": "张籍", - "title": "没蕃故人" - }, - { - "id": 152, - "contents": "离离原上草,一岁一枯荣。\n野火烧不尽,春风吹又生。\n远芳侵古道,晴翠接荒城。\n又送王孙去,萋萋满别情。", - "type": "五言律诗", - "author": "白居易", - "title": "赋得古原草送别" - }, - { - "id": 153, - "contents": "旅馆无良伴,凝情自悄然。\n寒灯思旧事,断雁警愁眠。\n远梦归侵晓,家书到隔年。\n沧江好烟月,门系钓鱼船。", - "type": "五言律诗", - "author": "杜牧", - "title": "旅宿" - }, - { - "id": 154, - "contents": "红叶晚萧萧,长亭酒一瓢。\n残云归太华,疏雨过中条。\n树色随山迥,河声入海遥。\n帝乡明日到,犹自梦渔樵。", - "type": "五言律诗", - "author": "许浑", - "title": "秋日赴阙题潼关驿楼" - }, - { - "id": 155, - "contents": "遥夜泛清瑟,西风生翠萝。\n残萤栖玉露,早雁拂银河。\n高树晓还密,远山晴更多。\n淮南一叶下,自觉老烟波。", - "type": "五言律诗", - "author": "许浑", - "title": "早秋" - }, - { - "id": 156, - "contents": "本以高难饱,徒劳恨费声。\n五更疏欲断,一树碧无情。\n薄宦梗犹泛,故园芜已平。\n烦君最相警,我亦举家清。", - "type": "五言律诗", - "author": "李商隐", - "title": "蝉" - }, - { - "id": 157, - "contents": "凄凉宝剑篇,羁泊欲穷年。\n黄叶仍风雨,青楼自管弦。\n新知遭薄俗,旧好隔良缘。\n心断新丰酒,销愁斗几千。", - "type": "五言律诗", - "author": "李商隐", - "title": "风雨" - }, - { - "id": 158, - "contents": "高阁客竟去,小园花乱飞。\n参差连曲陌,迢递送斜晖。\n肠断未忍扫,眼穿仍欲归。\n芳心向春尽,所得是沾衣。", - "type": "五言律诗", - "author": "李商隐", - "title": "落花" - }, - { - "id": 159, - "contents": "客去波平槛,蝉休露满枝。\n永怀当此节,倚立自移时。\n北斗兼春远,南陵寓使迟。\n天涯占梦数,疑误有新知。", - "type": "五言律诗", - "author": "李商隐", - "title": "凉思" - }, - { - "id": 160, - "contents": "残阳西入崦,茅屋访孤僧。\n落叶人何在?寒云路几层?\n独敲初夜磬,闲倚一枝藤。\n世界微尘里,吾宁爱与憎。", - "type": "五言律诗", - "author": "李商隐", - "title": "北青萝" - }, - { - "id": 161, - "contents": "荒戍落黄叶,浩然离故关。\n高风汉阳渡,初日郢门山。\n江上几人在?天涯孤棹还。\n何当重相见,樽酒慰离颜?", - "type": "五言律诗", - "author": "温庭筠", - "title": "送人东游" - }, - { - "id": 162, - "contents": "灞原风雨定,晚见雁行频。\n落叶他乡树,寒灯独夜人。\n空园白露滴,孤壁野僧邻。\n寄卧郊扉久,何年致此身?", - "type": "五言律诗", - "author": "马戴", - "title": "灞上秋居" - }, - { - "id": 163, - "contents": "露气寒光集,微阳下楚丘。\n猿啼洞庭树,人在木兰舟。\n广泽生明月,苍山夹乱流。\n云中君不见,竟夕自悲秋。", - "type": "五言律诗", - "author": "马戴", - "title": "楚江怀古" - }, - { - "id": 164, - "contents": "调角断清秋,征人倚戍楼。\n春风对青冢,白日落梁州。\n大漠无兵阻,穷边有客游。\n蕃情似此水,长愿向南流。", - "type": "五言律诗", - "author": "张乔", - "title": "书边事" - }, - { - "id": 165, - "contents": "迢递三巴路,羁危万里身。\n乱山残雪夜,孤独异乡春。\n渐与骨肉远,转於僮仆亲。\n那堪正飘泊,明日岁华新。", - "type": "五言律诗", - "author": "崔涂", - "title": "巴山道中除夜有怀" - }, - { - "id": 166, - "contents": "几行归塞尽,片影独何之?\n暮雨相呼失,寒塘欲下迟。\n渚云低暗渡,关月冷相随。\n未必逢[矢曾]缴,孤飞自可疑。", - "type": "五言律诗", - "author": "崔涂", - "title": "孤雁" - }, - { - "id": 167, - "contents": "早被婵娟误,欲妆临镜慵。\n承恩不在貌,教妾若为容。\n风暖鸟声碎,日高花影重。\n年年越溪女,相忆采芙蓉。", - "type": "五言律诗", - "author": "杜荀鹤", - "title": "春宫怨" - }, - { - "id": 168, - "contents": "清瑟怨遥夜,绕弦风雨哀。\n孤灯闻楚角,残月下章台。\n芳草已云暮,故人殊未来。\n乡书不可寄,秋雁又南回。", - "type": "五言律诗", - "author": "韦庄", - "title": "章台夜思" - }, - { - "id": 169, - "contents": "移家虽带郭,野径入桑麻。\n近种篱边菊,秋来未著花。\n扣门无犬吠,欲去问西家。\n报到山中去,归来每日斜。", - "type": "五言律诗", - "author": "僧皎然", - "title": "寻陆鸿渐不遇" - }, - { - "id": 170, - "contents": "昔人已乘黄鹤去,此地空馀黄鹤楼。\n黄鹤一去不复返,白云千载空悠悠。\n晴川历历汉阳树,芳草萋萋鹦鹉洲。\n日暮乡关何处是,烟波江上使人愁。", - "type": "七言律诗", - "author": "崔颢", - "title": "黄鹤楼" - }, - { - "id": 171, - "contents": "迢□(“绕”换山旁)太华俯咸京,天外三峰削不成。\n武帝祠前云欲散,仙人掌上雨初晴。\n河山北枕秦关险,驿树西连汉[田寺]平。\n借问路傍名利客,无如此处学长生。", - "type": "七言律诗", - "author": "崔颢", - "title": "行经华阴" - }, - { - "id": 172, - "contents": "燕台一去客心惊,箫鼓喧喧汉将营。\n万里寒光生积雪,三边曙色动危旌。\n沙场烽火侵胡月,海畔云山拥蓟城。\n少小虽非投笔吏,论功还欲请长缨。", - "type": "七言律诗", - "author": "祖咏", - "title": "望蓟门" - }, - { - "id": 173, - "contents": "朝闻游子唱骊歌,昨夜微霜初度河。\n鸿雁不堪愁里听,云山况是客中过。\n关城树色催寒近,御苑砧声向晚多。\n莫见长安行乐处,空令岁月易蹉跎。", - "type": "七言律诗", - "author": "李颀", - "title": "送魏万之京" - }, - { - "id": 174, - "contents": "汉文皇帝有高台,此日登临曙色开。\n三晋云山皆北向,二陵风雨自东来。\n关门令尹谁能识?河上仙翁去不回。\n且欲竟寻彭泽宰,陶然共醉菊花杯。", - "type": "七言律诗", - "author": "崔曙", - "title": "九日登望仙台呈刘明府" - }, - { - "id": 176, - "contents": "嗟君此别意何如?驻马衔杯问谪居。\n巫峡啼猿数行泪,衡阳归雁几封书。\n青枫江上秋帆远,白帝城边古木疏。\n圣代即今多雨露,暂时分手莫踌躇。", - "type": "七言律诗", - "author": "高适", - "title": "送李少府贬峡中王少府贬长沙" - }, - { - "id": 177, - "contents": "鸡鸣紫陌曙光寒,莺啭皇州春色阑。\n金阙晓钟开万户,玉阶仙仗拥千官。\n花迎剑佩星初落,柳拂旌旗露未干。\n独有凤凰池上客,阳春一曲和皆难。", - "type": "七言律诗", - "author": "岑参", - "title": "奉和中书舍人贾至早朝大明宫" - }, - { - "id": 178, - "contents": "绛帻鸡人送晓筹,尚衣方进翠云裘。\n九天阊阖开宫殿,万国衣冠拜冕旒。\n日色才临仙掌动,香烟欲傍衮龙浮。\n朝罢须裁五色诏,佩声归向凤池头。", - "type": "七言律诗", - "author": "王维", - "title": "和贾舍人早朝大明宫之作" - }, - { - "id": 179, - "contents": "渭水自萦秦塞曲,黄山旧绕汉宫斜。\n銮舆迥出千门柳,阁道回看上苑花。\n云里帝城双凤阙,雨中春树万人家。\n为乘阳气行时令,不是宸游玩物华。", - "type": "七言律诗", - "author": "王维", - "title": "奉和圣制从蓬莱向兴庆阁道中留春雨中春望之作应制" - }, - { - "id": 180, - "contents": "积雨空林烟火迟,蒸藜炊黍饷东□(“淄”去三点水加草头)。\n漠漠水田飞白鹭,阴阴夏木啭黄鹂。\n山中习静观朝槿,松下清斋折露葵。\n野老与人争席罢,海鸥何事更相疑。", - "type": "七言律诗", - "author": "王维", - "title": "积雨辋川庄作" - }, - { - "id": 181, - "contents": "洞门高阁霭馀辉,桃李阴阴柳絮飞。\n禁里疏钟官舍晚,省中啼鸟吏人稀。\n晨摇玉佩趋金殿,夕奉天书拜琐闱。\n强欲从君无那老,将因卧病解朝衣。", - "type": "七言律诗", - "author": "王维", - "title": "酬郭给事" - }, - { - "id": 182, - "contents": "丞相祠堂何处寻?锦官城外柏森森。\n映阶碧草自春色,隔叶黄鹂空好音。\n三顾频烦天下计,两朝开济老臣心。\n出师未捷身先死,长使英雄泪满襟!", - "type": "七言律诗", - "author": "杜甫", - "title": "蜀相" - }, - { - "id": 183, - "contents": "舍南舍北皆春水,但见群鸥日日来。\n花径不曾缘客扫,蓬门今始为君开。\n盘飧市远无兼味,樽酒家贫只旧醅。\n肯与邻翁相对饮,隔篱呼取尽馀杯!", - "type": "七言律诗", - "author": "杜甫", - "title": "客至" - }, - { - "id": 184, - "contents": "西山白雪三城戍,南浦清江万里桥。\n海内风尘诸弟隔,天涯涕泪一身遥。\n唯将迟暮供多病,未有涓埃答圣朝。\n跨马出郊时极目,不堪人事日萧条!", - "type": "七言律诗", - "author": "杜甫", - "title": "野望" - }, - { - "id": 185, - "contents": "剑外忽传收蓟北,初闻涕泪满衣裳。\n却看妻子愁何在,漫卷诗书喜欲狂。\n白日放歌须纵酒,青春作伴好还乡!\n即从巴峡穿巫峡,便下襄阳向洛阳。", - "type": "七言律诗", - "author": "杜甫", - "title": "闻官军收河南河北" - }, - { - "id": 186, - "contents": "风急天高猿啸哀,渚清沙白鸟飞回。\n无边落木萧萧下,不尽长江滚滚来。\n万里悲秋常作客,百年多病独登台。\n艰难苦恨繁霜鬓,潦倒新停浊酒杯。", - "type": "七言律诗", - "author": "杜甫", - "title": "登高" - }, - { - "id": 187, - "contents": "花近高楼伤客心,万方多难此登临。\n锦江春色来天地,玉垒浮云变古今。\n北极朝庭终不改,西山寇盗莫相侵!\n可怜后主还祠庙,日暮聊为梁父吟。", - "type": "七言律诗", - "author": "杜甫", - "title": "登楼" - }, - { - "id": 188, - "contents": "清秋幕府井梧寒,独宿江城蜡炬残。\n永夜角声悲自语,中天月色好谁看?\n风尘荏苒音书绝,关塞萧条行陆难。\n已忍伶俜十年事,强移栖息一枝安。", - "type": "七言律诗", - "author": "杜甫", - "title": "宿府" - }, - { - "id": 189, - "contents": "岁暮阴阳催短景,天涯霜雪霁寒霄。\n五更鼓角声悲壮,三峡星河影动摇。\n野哭千家闻战伐,夷歌数处起渔樵。\n卧龙跃马终黄土,人事音书漫寂寥。", - "type": "七言律诗", - "author": "杜甫", - "title": "阁夜" - }, - { - "id": 190, - "contents": "支离东北风尘际,漂泊西南天地间。\n三峡楼台淹日月,五溪衣服共云山。\n羯胡事主终无赖,词客哀时且未还。\n庾信平生最萧瑟,暮年诗赋动江关。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之一" - }, - { - "id": 191, - "contents": "摇落深知宋玉悲,风流儒雅亦吾师。\n怅望千秋一洒泪,萧条异代不同时。\n江山故宅空文藻,云雨荒台岂梦思!\n最是楚宫俱泯灭,舟人指点到今疑。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之二" - }, - { - "id": 192, - "contents": "群山万壑赴荆门,生长明妃尚有村。\n一去紫台连朔漠,独留青冢向黄昏。\n画图省识春风面,环佩空归月下魂。\n千载琵琶作胡语,分明怨恨曲中论。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之三" - }, - { - "id": 193, - "contents": "蜀主征吴幸三峡,崩年亦在永安宫。\n翠华想像空山里,玉殿虚无野寺中。\n古庙杉松巢水鹤,岁时伏腊走村翁。\n武侯祠屋常邻近,一体君臣祭祀同。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之四" - }, - { - "id": 194, - "contents": "诸葛大名垂宇宙,宗臣遗像肃清高。\n三分割据纡筹策,万古云霄一羽毛。\n伯仲之间见伊吕,指挥若定失萧曹。\n运移汉祚终难复,志决身歼军务劳。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之五" - }, - { - "id": 195, - "contents": "生涯岂料承优诏?世事空知学醉歌。\n江上月明胡雁过,淮南木落楚山多。\n寄身且喜沧洲近,顾影无如白发何!\n今日龙钟人共老,愧君犹遣慎风波。", - "type": "七言律诗", - "author": "刘长卿", - "title": "江州重别薛六柳八二员外" - }, - { - "id": 196, - "contents": "三年谪宦此栖迟,万古惟留楚客悲。\n秋草独寻人去后,寒林空见日斜时。\n汉文有道恩犹薄,湘水无情吊岂知?\n寂寂江山摇落处,怜君何事到天涯!", - "type": "七言律诗", - "author": "刘长卿", - "title": "长沙过贾谊宅" - }, - { - "id": 197, - "contents": "汀洲无浪复无烟,楚客相思益渺然。\n汉口夕阳斜渡鸟,洞庭秋水远连天。\n孤城背岭寒吹角,独戍临江夜泊船。\n贾谊上书忧汉室,长沙谪去古今怜。", - "type": "七言律诗", - "author": "刘长卿", - "title": "自夏口至鹦洲夕望岳阳寄源中丞" - }, - { - "id": 198, - "contents": "二月黄鹂飞上林,春城紫禁晓阴阴。\n长乐钟声花外尽,龙池柳色雨中深。\n阳和不散穷途恨,霄汉长怀捧日心。\n献赋十年犹未遇,羞将白发对华簪。", - "type": "七言律诗", - "author": "钱起", - "title": "赠阙下裴舍人" - }, - { - "id": 199, - "contents": "去年花里逢君别,今日花开又一年。\n世事茫茫难自料,春愁黯黯独成眠。\n身多疾病思田里,邑有流亡愧俸钱。\n闻道欲来相问讯,西楼望月几回圆?", - "type": "七言律诗", - "author": "韦应物", - "title": "寄李儋元锡" - }, - { - "id": 200, - "contents": "仙台初见五城楼,风物凄凄宿雨收。\n山色遥连秦树晚,砧声近报汉宫秋。\n疏松影落空坛静,细草香闲小洞幽。\n何用别寻方外去,人间亦自有丹丘!", - "type": "七言律诗", - "author": "韩□", - "title": "同题仙游观" - }, - { - "id": 201, - "contents": "莺啼燕语报新年,马邑龙堆路几千。\n家住层城邻汉苑,心随明月到胡天。\n机中锦字论长恨,楼上花枝笑独眠。\n为问天戎窦车骑,何时返旆勒燕然?", - "type": "七言律诗", - "author": "皇甫冉", - "title": "春思" - }, - { - "id": 202, - "contents": "云开远见汉阳城,犹是孤帆一日程。\n估客昼眠知浪静,舟人夜语觉潮生。\n三湘愁鬓逢秋色,万里归心对月明。\n旧业已随征战尽,更堪江上鼓鼙声。", - "type": "七言律诗", - "author": "卢纶", - "title": "晚次鄂州" - }, - { - "id": 203, - "contents": "城上高楼接大荒,海天愁思正茫茫。\n惊风乱[风占)芙蓉水,密雨斜侵薜荔墙。\n岭树重遮千里目,江流曲似九回肠。\n共来百越文身地,犹自音书滞一乡。", - "type": "七言律诗", - "author": "柳宗元", - "title": "登柳州城楼寄漳汀封连四州刺史" - }, - { - "id": 204, - "contents": "王浚楼船下益州,金陵王气黯然收。\n千寻铁锁沈江底,一片降幡出石头。\n人世几回伤往事?山形依旧枕寒流。\n从今四海为家日,故垒萧萧芦荻秋。", - "type": "七言律诗", - "author": "刘禹锡", - "title": "西塞山怀古" - }, - { - "id": 205, - "contents": "谢公最小偏怜女,自嫁黔娄百事乖。\n顾我无衣搜荩箧,泥他沽酒拔金钗。\n野蔬充膳甘长藿,落叶添薪仰古槐。\n今日俸钱过十万,与君营奠复营斋。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之一" - }, - { - "id": 206, - "contents": "昔日戏言身后事,今朝都到眼前来。\n衣裳已施行看尽,针线犹存未忍开。\n尚想旧情怜婢仆,也曾因梦送钱财。\n诚知此恨人人有,贫贱夫妻百事哀。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之二" - }, - { - "id": 207, - "contents": "闲坐悲君亦自悲,百年都是几多时?\n邓攸无子寻知命,潘岳悼亡犹费词。\n同穴□(上“穴”下“目”)冥何所望,他生缘会更难期。\n惟将终夜长开眼,报答平生未展眉。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之三" - }, - { - "id": 208, - "contents": "时难年荒世业空,弟兄羁旅各西东。\n田园寥落干戈后,骨肉流离道路中。\n吊影分为千里雁,辞根散作九秋蓬。\n共看明月应垂泪,一夜乡心五处同。", - "type": "七言律诗", - "author": "白居易", - "title": "望月有感" - }, - { - "id": 209, - "contents": "锦瑟无端五十弦,一弦一柱思华年。\n庄生晓梦迷蝴蝶,望帝春心托杜鹃。\n沧海月明珠有泪,蓝田日暖玉生烟。\n此情可待成追忆,只是当时已惘然。", - "type": "七言律诗", - "author": "李商隐", - "title": "锦瑟" - }, - { - "id": 210, - "contents": "昨夜星辰昨夜风,画楼西畔桂堂东。\n身无彩凤双飞翼,心有灵犀一点通。\n隔座送钩春酒暖,分曹射覆蜡灯红。\n嗟余听鼓应官去,走马兰台类转蓬。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题" - }, - { - "id": 211, - "contents": "紫泉宫殿锁烟霞,欲取芜城作帝家。\n玉玺不缘归日角,锦帆应是到天涯。\n於今腐草无萤火,终古垂杨有暮鸦。\n地下若逢陈后主,岂宜重问后庭花?", - "type": "七言律诗", - "author": "李商隐", - "title": "隋宫" - }, - { - "id": 212, - "contents": "来是空言去绝踪,月斜楼上五更钟。\n梦为远别啼难唤,书被催成墨未浓。\n蜡照半笼金翡翠,麝熏微度绣芙蓉。\n刘郎已恨蓬山远,更隔蓬山一万重。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之一" - }, - { - "id": 213, - "contents": "飒飒东风细雨来,芙蓉塘外有轻雷。\n金蟾啮锁烧香入,玉虎牵丝汲井回。\n贾氏窥帘韩掾少,宓妃留枕魏王才。\n春心莫共花争发,一寸相思一寸灰。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之二" - }, - { - "id": 214, - "contents": "猿鸟犹疑畏简书,风云常为护储胥。\n徒令上将挥神笔,终见降王走传车。\n管乐有才原不忝,关张无命欲何如。\n他年锦里经祠庙,梁父吟成恨有馀。", - "type": "七言律诗", - "author": "李商隐", - "title": "筹笔驿" - }, - { - "id": 215, - "contents": "相见时难别亦难,东风无力百花残。\n春蚕到死丝方尽,蜡炬成灰泪始干。\n晓镜但愁云鬓改,夜吟应觉月光寒。\n蓬莱此去无多路,青鸟殷勤为探看。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题" - }, - { - "id": 216, - "contents": "怅卧新春白袷衣,白门寥落意多违。\n红楼隔雨相望冷,珠箔飘灯独自归。\n远路应悲春[日宛]晚,残宵犹得梦依稀。\n玉[王当]缄札何由达?万里云罗一雁飞。", - "type": "七言律诗", - "author": "李商隐", - "title": "春雨" - }, - { - "id": 217, - "contents": "凤尾香罗薄几重,碧文圆顶夜深缝。\n扇裁月魄羞难掩,车走雷声语未通。\n曾是寂寥金烬暗,断无消息石榴红。\n斑骓只系垂杨岸,何处西南任好风?", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之一" - }, - { - "id": 218, - "contents": "重帷深下莫愁堂,卧后清宵细细长。\n神女生涯原是梦,小姑居处本无郎。\n风波不信菱枝弱,月露谁教桂叶香?\n直道相思了无益,未妨惆怅是清狂。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之二" - }, - { - "id": 219, - "contents": "澹然空水对斜晖,曲岛苍茫接翠微。\n波上马嘶看棹去,柳边人歇待船归。\n数丛沙草群鸥散,万顷江田一鹭飞。\n谁解乘舟寻范蠡,五湖烟水独忘机?", - "type": "七言律诗", - "author": "温庭筠", - "title": "利洲南渡" - }, - { - "id": 220, - "contents": "苏武魂销汉使前,古祠高树两茫然。\n云边雁断胡天月,陇上羊归塞草烟。\n回日楼台非甲帐,去时冠剑是丁年。\n茂陵不见封侯印,空向秋波哭逝川。", - "type": "七言律诗", - "author": "温庭筠", - "title": "苏武庙" - }, - { - "id": 221, - "contents": "十二楼中尽晓妆,望仙楼上望君王。\n锁衔金兽连环冷,水滴铜龙昼漏长。\n云髻罢梳还对镜,罗衣欲换更添香。\n遥窥正殿帘开处,袍裤宫人扫御床。", - "type": "七言律诗", - "author": "薛逢", - "title": "宫词" - }, - { - "id": 222, - "contents": "蓬门未识绮罗香,拟托良媒益自伤。\n谁爱风流高格调?共怜时世俭梳妆。\n敢将十指夸针巧,不把双眉斗画长。\n苦恨年年压金线,为他人作嫁衣裳。", - "type": "七言律诗", - "author": "秦韬玉", - "title": "贫女" - }, - { - "id": 223, - "contents": "卢家少妇郁金香,海燕双栖玳瑁梁。\n九月寒砧催木叶,十年征戍忆辽阳。\n白狼河北音书断,丹凤城南秋夜长。\n谁为含愁独不见,更教明月照流黄?", - "type": "七言律诗", - "author": "沈全期", - "title": "古意呈补阙乔知之" - }, - { - "id": 224, - "contents": "空山不见人,但闻人语响。\n返景入深林,复照青苔上。", - "type": "五言绝句", - "author": "王维", - "title": "鹿柴" - }, - { - "id": 225, - "contents": "独坐幽篁里,弹琴复长啸。\n深林人不知,明月来相照。", - "type": "五言绝句", - "author": "王维", - "title": "竹里馆" - }, - { - "id": 226, - "contents": "山中相送罢,日暮掩柴扉。\n春草明年绿,王孙归不归?", - "type": "五言绝句", - "author": "王维", - "title": "送别" - }, - { - "id": 227, - "contents": "红豆生南国,春来发几枝?\n愿君多采撷,此物最相思。", - "type": "五言绝句", - "author": "王维", - "title": "相思" - }, - { - "id": 228, - "contents": "君自故乡来,应知故乡事。\n来日绮窗前,寒梅著花未?", - "type": "五言绝句", - "author": "王维", - "title": "杂诗" - }, - { - "id": 229, - "contents": "归山深浅去,须尽丘壑美。\n莫学武陵人,暂游桃源里。", - "type": "五言绝句", - "author": "裴迪", - "title": "送崔九" - }, - { - "id": 230, - "contents": "终南阴岭秀,积雪浮云端。\n林表明霁色,城中增暮寒。", - "type": "五言绝句", - "author": "祖咏", - "title": "终南望馀雪" - }, - { - "id": 231, - "contents": "移舟泊烟渚,日暮客愁新。\n野旷天低树,江清月近人。", - "type": "五言绝句", - "author": "孟浩然", - "title": "宿建德江" - }, - { - "id": 232, - "contents": "春眠不觉晓,处处闻啼鸟。\n夜来风雨声,花落知多少?", - "type": "五言绝句", - "author": "孟浩然", - "title": "春晓" - }, - { - "id": 233, - "contents": "床前明月光,疑是地上霜。\n举头望明月,低头思故乡。", - "type": "五言绝句", - "author": "李白", - "title": "夜思" - }, - { - "id": 234, - "contents": "美人卷珠帘,深坐蹙蛾眉。\n但见泪痕湿,不知心恨谁?", - "type": "五言绝句", - "author": "李白", - "title": "怨情" - }, - { - "id": 235, - "contents": "功盖三分国,名成八阵图。\n江流石不转,遗恨失吞吴。", - "type": "五言绝句", - "author": "杜甫", - "title": "八阵图" - }, - { - "id": 236, - "contents": "白日依山尽,黄河入海流。\n欲穷千里目,更上一层楼。", - "type": "五言绝句", - "author": "王之涣", - "title": "登鹳雀楼" - }, - { - "id": 237, - "contents": "苍苍竹林寺,杳杳钟声晚。\n荷笠带斜阳,青山独归远。", - "type": "五言绝句", - "author": "刘长卿", - "title": "送灵澈" - }, - { - "id": 238, - "contents": "泠泠七弦上,静听松风寒。\n古调虽自爱,今人多不弹。", - "type": "五言绝句", - "author": "刘长卿", - "title": "弹琴" - }, - { - "id": 239, - "contents": "孤云将野鹤,岂向人间住!\n莫买沃洲山,时人已知处。", - "type": "五言绝句", - "author": "刘长卿", - "title": "送上人" - }, - { - "id": 240, - "contents": "怀君属秋夜,散步咏凉天。\n空山松子落,幽人应未眠。", - "type": "五言绝句", - "author": "韦应物", - "title": "秋夜寄邱员外" - }, - { - "id": 241, - "contents": "鸣筝金粟柱,素手玉房前。\n欲得周郎顾,时时误拂弦。", - "type": "五言绝句", - "author": "李端", - "title": "听筝" - }, - { - "id": 242, - "contents": "三日入厨下,洗手作羹汤。\n未谙姑食性,先遣小姑尝。", - "type": "五言绝句", - "author": "王建", - "title": "新嫁娘" - }, - { - "id": 243, - "contents": "昨夜裙带解,今朝[虫喜]子飞。\n铅华不可弃,莫是藁砧归。", - "type": "五言绝句", - "author": "权德舆", - "title": "玉台体" - }, - { - "id": 244, - "contents": "千山鸟飞绝,万径人踪灭。\n孤舟蓑笠翁,独钓寒江雪。", - "type": "五言绝句", - "author": "柳宗元", - "title": "江雪" - }, - { - "id": 245, - "contents": "寥落古行宫,宫花寂寞红。\n白头宫女在,闲坐说玄宗。", - "type": "五言绝句", - "author": "元稹", - "title": "行宫" - }, - { - "id": 246, - "contents": "绿蚁新醅酒,红泥小火炉。\n晚来天欲雪,能饮一杯无?", - "type": "五言绝句", - "author": "白居易", - "title": "问刘十九" - }, - { - "id": 247, - "contents": "故国三千里,深宫二十年。\n一声何满子,双泪落君前。", - "type": "五言绝句", - "author": "张祜", - "title": "何满子" - }, - { - "id": 248, - "contents": "向晚意不适,驱车登古原。\n夕阳无限好,只是近黄昏。", - "type": "五言绝句", - "author": "李商隐", - "title": "登乐游原" - }, - { - "id": 249, - "contents": "松下问童子,言师采药去。\n只在此山中,云深不知处。", - "type": "五言绝句", - "author": "贾岛", - "title": "寻隐者不遇" - }, - { - "id": 250, - "contents": "岭外音书绝,经冬复立春。\n近乡情更怯,不敢问来人。", - "type": "五言绝句", - "author": "李频", - "title": "渡汉江" - }, - { - "id": 251, - "contents": "打起黄莺儿,莫教枝上啼。\n啼时惊妾梦,不得到辽西。", - "type": "五言绝句", - "author": "金昌绪", - "title": "春怨" - }, - { - "id": 178, - "contents": "北斗七星高,哥舒夜带刀。\n至今窥牧马,不敢过临洮。", - "type": "七言律诗", - "author": "西鄙人", - "title": "哥舒歌" - }, - { - "id": 253, - "contents": "君家何处住,妾住在横塘。\n停船暂借问,或恐是同乡。", - "type": "五言绝句", - "author": "崔颢", - "title": "长干行二首之一" - }, - { - "id": 254, - "contents": "家临九江水,来去九江侧。\n同是长干人,生小不相识。", - "type": "五言绝句", - "author": "崔颢", - "title": "长干行二首之二" - }, - { - "id": 255, - "contents": "玉阶生白露,夜久侵罗袜。\n却下水晶帘,玲珑望秋月。", - "type": "五言绝句", - "author": "李白", - "title": "玉阶怨" - }, - { - "id": 256, - "contents": "鹫翎金仆姑,燕尾绣蝥弧。\n独立扬新令,千营共一呼。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之一" - }, - { - "id": 257, - "contents": "林暗草惊风,将军夜引弓。\n平明寻白羽,没在石棱中。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之二" - }, - { - "id": 258, - "contents": "月黑雁飞高,单于夜遁逃。\n欲将轻骑逐,大雪满弓刀。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之三" - }, - { - "id": 259, - "contents": "野幕蔽琼筵,羌戎贺劳旋。\n醉和金甲舞,雷鼓动山川。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之四" - }, - { - "id": 260, - "contents": "嫁得瞿塘贾,朝朝误妾期。\n早知潮有信,嫁与弄潮儿。", - "type": "五言绝句", - "author": "李益", - "title": "江南曲" - }, - { - "id": 261, - "contents": "少小离家老大回,乡音无改鬓毛衰。\n儿童相见不相识,笑问客从何处来?", - "type": "七言绝句", - "author": "贺知章", - "title": "回乡偶书" - }, - { - "id": 262, - "contents": "隐隐飞桥隔野烟,石矶西畔问渔船。\n桃花尽日随流水,洞在清溪何处边?", - "type": "七言绝句", - "author": "张旭", - "title": "桃花溪" - }, - { - "id": 263, - "contents": "独在异乡为异客,每逢佳节倍思亲。\n遥知兄弟登高处,遍插茱萸少一人。", - "type": "七言绝句", - "author": "王维", - "title": "九月九日忆山东兄弟" - }, - { - "id": 264, - "contents": "寒雨连江夜入吴,平明送客楚山孤。\n洛阳亲友如相问,一片冰心在玉壶。", - "type": "七言绝句", - "author": "王昌龄", - "title": "芙蓉楼送辛渐" - }, - { - "id": 265, - "contents": "闺中少妇不知愁,春日凝妆上翠楼。\n忽见陌头杨柳色,悔教夫婿觅封侯。", - "type": "七言绝句", - "author": "王昌龄", - "title": "闺怨" - }, - { - "id": 266, - "contents": "昨夜风开露井桃,未央前殿月轮高。\n平阳歌舞新承宠,帘外春寒赐锦袍。", - "type": "七言绝句", - "author": "王昌龄", - "title": "春宫曲" - }, - { - "id": 267, - "contents": "葡萄美酒夜光杯,欲饮琵琶马上催。\n醉卧沙场君莫笑,古来征战几人回!", - "type": "七言绝句", - "author": "王翰", - "title": "凉州词" - }, - { - "id": 268, - "contents": "故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。", - "type": "七言绝句", - "author": "李白", - "title": "送孟浩然之广陵" - }, - { - "id": 269, - "contents": "朝辞白帝彩云间,千里江陵一日还。\n两岸猿声啼不住,轻舟已过万重山。", - "type": "七言绝句", - "author": "李白", - "title": "下江陵" - }, - { - "id": 270, - "contents": "故园东望路漫漫,双袖龙钟泪不干。\n马上相逢无纸笔,凭君传语报平安。", - "type": "七言绝句", - "author": "岑参", - "title": "逢入京使" - }, - { - "id": 271, - "contents": "岐王宅里寻常见,崔九堂前几度闻。\n正是江南好风景,落花时节又逢君。", - "type": "七言绝句", - "author": "杜甫", - "title": "江南逢李龟年" - }, - { - "id": 272, - "contents": "独怜幽草涧边生,上有黄鹂深树鸣。\n春潮带雨晚来急,野渡无人舟自横。", - "type": "七言绝句", - "author": "韦应物", - "title": "滁州西涧" - }, - { - "id": 273, - "contents": "月落乌啼霜满天,江枫渔火对愁眠。\n姑苏城外寒山寺,夜半钟声到客船。", - "type": "七言绝句", - "author": "张继", - "title": "枫桥夜泊" - }, - { - "id": 274, - "contents": "春城无处不飞花,寒食东风御柳斜。\n日暮汉宫传蜡烛,轻烟散入五侯家。", - "type": "七言绝句", - "author": "韩□", - "title": "寒食" - }, - { - "id": 275, - "contents": "更深月色半人家,北斗阑干南斗斜。\n今夜偏知春气暖,虫声新透绿窗纱。", - "type": "七言绝句", - "author": "刘方平", - "title": "月夜" - }, - { - "id": 276, - "contents": "纱窗日落渐黄昏,金屋无人见泪痕。\n寂寞空庭春欲晚,梨花满地不开门。", - "type": "七言绝句", - "author": "刘方平", - "title": "春怨" - }, - { - "id": 277, - "contents": "岁岁金河复玉关,朝朝马策与刀环。\n三春白雪归青冢,万里黄河绕黑山。", - "type": "七言绝句", - "author": "柳中庸", - "title": "征人怨" - }, - { - "id": 278, - "contents": "玉楼天半起笙歌,风送宫嫔笑语和。\n月殿影开闻夜漏,水晶帘卷近秋河。", - "type": "七言绝句", - "author": "顾况", - "title": "宫词" - }, - { - "id": 279, - "contents": "回乐峰前沙似雪,受降城外月如霜。\n不知何处吹芦管,一夜征人尽望乡。", - "type": "七言绝句", - "author": "李益", - "title": "夜上受降城闻笛" - }, - { - "id": 280, - "contents": "朱雀桥边野草花,乌衣巷口夕阳斜。\n旧时王谢堂前燕,飞入寻常百姓家。", - "type": "七言绝句", - "author": "刘禹锡", - "title": "乌衣巷" - }, - { - "id": 281, - "contents": "新妆宜面下朱楼,深锁春光一院愁。\n行到中庭数花朵,蜻蜓飞上玉搔头。", - "type": "七言绝句", - "author": "刘禹锡", - "title": "春词" - }, - { - "id": 282, - "contents": "泪湿罗巾梦不成,夜深前殿按歌声。\n红颜未老恩先断,斜倚薰笼坐到明。", - "type": "七言绝句", - "author": "白居易", - "title": "后宫词" - }, - { - "id": 283, - "contents": "禁门宫树月痕过,媚眼惟看宿鹭窠。\n斜拔玉钗灯影畔,剔开红焰救飞蛾。", - "type": "七言绝句", - "author": "张祜", - "title": "赠内人" - }, - { - "id": 284, - "contents": "日光斜照集灵台,红树花迎晓露开。\n昨夜上皇新授□(“录”加竹头),太真含笑入帘来。", - "type": "七言绝句", - "author": "张祜", - "title": "集灵台二首之一" - }, - { - "id": 285, - "contents": "虢国夫人承主恩,平明骑马入宫门。\n却嫌脂粉污颜色,淡扫蛾眉朝至尊。", - "type": "七言绝句", - "author": "张祜", - "title": "集灵台二首之二" - }, - { - "id": 286, - "contents": "金陵津渡小山楼,一宿行人自可愁。\n潮落夜江斜月里,两三星火是瓜州。", - "type": "七言绝句", - "author": "张祜", - "title": "题金陵渡" - }, - { - "id": 287, - "contents": "寂寂花时闭院门,美人相并立琼轩。\n含情欲说宫中事,鹦鹉前头不敢言。", - "type": "七言绝句", - "author": "朱庆馀", - "title": "宫词" - }, - { - "id": 288, - "contents": "洞房昨夜停红烛,待晓堂前拜舅姑。\n妆罢低声问夫婿,画眉深浅入时无?", - "type": "七言绝句", - "author": "朱庆馀", - "title": "近试上张水部" - }, - { - "id": 289, - "contents": "清时有味是无能,闲爱孤云静爱僧。\n欲把一麾江海去,乐游原上望昭陵。", - "type": "七言绝句", - "author": "杜牧", - "title": "将赴吴兴登乐游原" - }, - { - "id": 290, - "contents": "折戟沈沙铁未销,自将磨洗认前朝。\n东风不与周郎便,铜雀春深销二乔。", - "type": "七言绝句", - "author": "杜牧", - "title": "赤壁" - }, - { - "id": 291, - "contents": "烟笼寒水月笼沙,夜泊秦淮近酒家。\n商女不知亡国恨,隔江犹唱《后庭花》。", - "type": "七言绝句", - "author": "杜牧", - "title": "泊秦淮" - }, - { - "id": 292, - "contents": "青山隐隐水迢迢,秋尽江南草未凋。\n二十四桥明月夜,玉人何处教吹箫?", - "type": "七言绝句", - "author": "杜牧", - "title": "寄扬州韩绰判官" - }, - { - "id": 293, - "contents": "落魄江湖载酒行,楚腰纤细掌中轻。\n十年一觉扬州梦,赢得青楼薄幸名。", - "type": "七言绝句", - "author": "杜牧", - "title": "遣怀" - }, - { - "id": 294, - "contents": "银烛秋光冷画屏,轻罗小扇扑流萤。\n天阶夜色凉如水,坐看牵牛织女星。", - "type": "七言绝句", - "author": "杜牧", - "title": "秋夕" - }, - { - "id": 295, - "contents": "娉娉袅袅十三馀,豆蔻梢头二月初。\n春风十里扬州路,卷上珠帘总不如。", - "type": "七言绝句", - "author": "杜牧", - "title": "赠别二首之一" - }, - { - "id": 296, - "contents": "多情却似总无情,唯觉樽前笑不成。\n蜡烛有心还惜别,替人垂泪到天明。", - "type": "七言绝句", - "author": "杜牧", - "title": "赠别二首之二" - }, - { - "id": 297, - "contents": "繁华事散逐香尘,流水无情草自春。\n日暮东风怨啼鸟,落花犹似坠楼人。", - "type": "七言绝句", - "author": "杜牧", - "title": "金谷园" - }, - { - "id": 298, - "contents": "君问归期未有期,巴山夜雨涨秋池。\n何当共剪西窗烛,却话巴山夜雨时?", - "type": "七言绝句", - "author": "李商隐", - "title": "夜雨寄北" - }, - { - "id": 299, - "contents": "嵩云秦树久离居,双鲤迢迢一纸笔。\n休问梁园旧宾客,茂陵秋雨病相如。", - "type": "七言绝句", - "author": "李商隐", - "title": "寄令狐郎中" - }, - { - "id": 300, - "contents": "为有云屏无限娇,凤城寒尽怕春宵。\n无端嫁得金龟婿,辜负香衾事早朝。", - "type": "七言绝句", - "author": "李商隐", - "title": "为有" - }, - { - "id": 301, - "contents": "乘兴南游不戒严,九重谁省谏书函?\n春风举国裁宫锦,半作障泥半作帆。", - "type": "七言绝句", - "author": "李商隐", - "title": "隋宫" - }, - { - "id": 302, - "contents": "瑶池阿母绮窗开,黄竹歌声动地哀。\n八骏日行三万里,穆王何事不重来?", - "type": "七言绝句", - "author": "李商隐", - "title": "瑶池" - }, - { - "id": 303, - "contents": "云母屏风烛影深,长河渐落晓星沈。\n嫦娥应悔偷灵药,碧海青天夜夜心。", - "type": "七言绝句", - "author": "李商隐", - "title": "嫦娥" - }, - { - "id": 304, - "contents": "宣室求贤访逐臣,贾生才调更无伦。\n可怜夜半虚前席,不问苍生问鬼神!", - "type": "七言绝句", - "author": "李商隐", - "title": "贾生" - }, - { - "id": 305, - "contents": "冰簟银床梦不成,碧天如水夜云轻。\n雁声远过潇湘去,十二楼中月自明。", - "type": "七言绝句", - "author": "温庭筠", - "title": "瑶瑟怨" - }, - { - "id": 306, - "contents": "玄宗回马杨妃死,云雨难忘日月新。\n终是圣明天子事,景阳宫井又何人?", - "type": "七言绝句", - "author": "郑畋", - "title": "马嵬坡" - }, - { - "id": 307, - "contents": "碧阑干外绣帘垂,猩色屏风画折枝。\n八尺龙须方锦褥,已凉天气未寒时。", - "type": "七言绝句", - "author": "韩□", - "title": "已凉" - }, - { - "id": 308, - "contents": "江雨霏霏江草齐,六朝如梦鸟空啼。\n无情最是台城柳,依旧烟笼十里堤。", - "type": "七言绝句", - "author": "韦庄", - "title": "金陵图" - }, - { - "id": 309, - "contents": "誓扫匈奴不顾身,五千貂锦丧胡尘。\n可怜无定河边骨,犹是深闺梦里人!", - "type": "七言绝句", - "author": "陈陶", - "title": "陇西行" - }, - { - "id": 310, - "contents": "别梦依依到谢家,小廊回合曲阑斜。\n多情只有春庭月,犹为离人照落花。", - "type": "七言绝句", - "author": "张泌", - "title": "寄人" - }, - { - "id": 311, - "contents": "尽寒食雨草萋萋,著麦苗风柳映堤。\n等是有家归未得,杜鹃休向耳边啼。", - "type": "七言绝句", - "author": "无名氏", - "title": "杂诗" - }, - { - "id": 312, - "contents": "渭城朝雨[氵邑]轻尘,客舍青青柳色新。\n劝君更尽一杯酒,西出阳关无故人。", - "type": "七言绝句", - "author": "王维", - "title": "渭城曲" - }, - { - "id": 313, - "contents": "桂魄初生秋露微,轻罗已薄未更衣。\n银筝夜久殷勤弄,心怯空房不忍归!", - "type": "七言绝句", - "author": "王维", - "title": "秋夜曲" - }, - { - "id": 314, - "contents": "奉帚平明金殿开,且将团扇共徘徊。\n玉颜不及寒鸦色,犹带昭阳日影来。", - "type": "七言绝句", - "author": "王昌龄", - "title": "长信怨" - }, - { - "id": 315, - "contents": "秦时明月汉时关,万里长征人未还。\n但使龙城飞将在,不教胡马渡阴山!", - "type": "七言绝句", - "author": "王昌龄", - "title": "出塞" - }, - { - "id": 316, - "contents": "黄河远上白云间,一片孤城万仞山。\n羌笛何须怨杨柳?春风不度玉门关。", - "type": "七言绝句", - "author": "王之涣", - "title": "出塞" - }, - { - "id": 317, - "contents": "云想衣裳花想容,春风拂槛露华浓。\n若非群玉山头见,会向瑶台月下逢。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之一" - }, - { - "id": 318, - "contents": "一枝红艳露凝香,云雨巫山枉断肠。\n借问汉宫谁得似?可怜飞燕倚新妆。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之二" - }, - { - "id": 319, - "contents": "名花倾国两相欢,常得君王带笑看。\n解释春风无限恨,沈香亭北倚阑干。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之三" - }, - { - "id": 320, - "contents": "劝君莫惜金缕衣,劝君惜取少年时。\n花开堪折直须折,莫待无花空折枝!", - "type": "七言绝句", - "author": "杜秋娘", - "title": "金缕衣" - } -] diff --git a/exercises/1901090045/1001S02E03_calculator.py b/exercises/1901090045/1001S02E03_calculator.py deleted file mode 100644 index 750a52ed4..000000000 --- a/exercises/1901090045/1001S02E03_calculator.py +++ /dev/null @@ -1,30 +0,0 @@ -def add(x,y): - return x + y -def subtract(x,y): - return x - y -def multiply(x,y): - return x * y -def divide(x,y): - return x / y - -print("Please choose the calculation method:") -print("1'ADD") -print("2'SUBSTRACT") -print("3'MULTIPLY") -print("4'DIVIDE") - -choice = input("Please enter the serial number of calculation method: ") - -number1 = int(input("Please enter the first number: ")) -number2 = int(input("Please enter the second number:")) - -if choice == '1': - print(number1, "+", number2, "=", add(number1, number2)) -elif choice == '2': - print(number1, "-", number2, "=", subtract(number1, number2)) -elif choice == '3': - print(number1, "*", number2, "=", multiply(number1, number2)) -elif choice == '4': - print(number1, "/", number2, "=", divide(number1, number2)) -else: - print("ERROR") diff --git a/exercises/1901090072/1001S02E01helloworld.txt b/exercises/1901090072/1001S02E01helloworld.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/exercises/1901090072/README.md b/exercises/1901090072/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/exercises/1901100005/d08/main.py b/exercises/1901100005/d08/main.py deleted file mode 100644 index 7bab121d9..000000000 --- a/exercises/1901100005/d08/main.py +++ /dev/null @@ -1,43 +0,0 @@ -text = ''' -愚公移山 -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大力神揹走二山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked yugong’s way making it inconvenient for him and his family to get around. -One day yugong gathered his family together and said,”Let’s do our best to level these two mountains. We shall open a road that leads to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered his wife. “How on earth do you suppose you can level Mount Taixin and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed Yugong saying,”Aren’t you foolish, my friend? You are very old now, and with whatever remains of your waning strength, you won’t be able to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. - ''' - -from mymodule import stats_word #从mydouble这个文件夹里调用stats_word文件里的stats_text程序 -text = 123 #输入非字符串 -try: #try-except: 运行try代码判断try:如果try报错,则会执行except部分。 - print(stats_word.stats_text(text)) #如果try没有报错,程序会跳过except部分。 -except ValueError as e : #Except:捕获ValueError异常, ValueError输入一个调用者不期望的值, 'as e'将故障信息加载到变量e中。 - print(e) #e是错误的详细信息 - - - - - - diff --git a/exercises/1901100005/d08/mymodule/stats_word.py b/exercises/1901100005/d08/mymodule/stats_word.py deleted file mode 100644 index 2c13cea0c..000000000 --- a/exercises/1901100005/d08/mymodule/stats_word.py +++ /dev/null @@ -1,57 +0,0 @@ -text = ''' -愚公移山 -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大力神揹走二山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked yugong’s way making it inconvenient for him and his family to get around. -One day yugong gathered his family together and said,”Let’s do our best to level these two mountains. We shall open a road that leads to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered his wife. “How on earth do you suppose you can level Mount Taixin and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed Yugong saying,”Aren’t you foolish, my friend? You are very old now, and with whatever remains of your waning strength, you won’t be able to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. - ''' -import re -import collections -def stats_text_cn(text): - if not isinstance(text,str): #如果检测到text中的对象不是str字符串类型 - raise ValueError('type of argumengt is not str') #抛出异常 - p=re.compile(u'[\u4e00-\u9fa5]') - a=re.findall(p,text) - str1=''.join(a) - print(collections.Counter(str1)) -def stats_text_en(text): - if type(text) == str: #尽量使用isinstance。 - #type与isinstance都可以用来判断变量的类型,但是type具有一定的适用性,用它来判断变量并不总是能够获取到正确的值。 - b=re.sub(r'[^A-Za-z]',' ',text) - list=b.split() - print(collections.Counter(list)) - else: - raise ValueError('type of argumengt is not str') -def stats_text(text): - if not isinstance(text,str): - raise ValueError('type of argumengt is not str') - stats_text_cn(text) - stats_text_en(text) -stats_text(text) - - - - diff --git a/exercises/1901100005/d09/main.py b/exercises/1901100005/d09/main.py deleted file mode 100644 index f0b6d4580..000000000 --- a/exercises/1901100005/d09/main.py +++ /dev/null @@ -1,9 +0,0 @@ -from mymodule import stats_word -import json -#路径前+r,避免转义。 -with open(r'C:\Users\CS-Mu\Documents\selfteaching-python-camp\exercises\1901010061\d09\tang300.json',encoding='UTF-8') as f: - read_date = f.read() -try: - print('统计汉字字频最高的前100个字: \n',stats_word.stats_text_cn(read_date,100)) -except ValueError as e: - print(e) diff --git a/exercises/1901100005/d09/mymodule/stats_word.py b/exercises/1901100005/d09/mymodule/stats_word.py deleted file mode 100644 index 2e631a539..000000000 --- a/exercises/1901100005/d09/mymodule/stats_word.py +++ /dev/null @@ -1,58 +0,0 @@ -text = ''' -愚公移山 -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大力神揹走二山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked yugong’s way making it inconvenient for him and his family to get around. -One day yugong gathered his family together and said,”Let’s do our best to level these two mountains. We shall open a road that leads to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered his wife. “How on earth do you suppose you can level Mount Taixin and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed Yugong saying,”Aren’t you foolish, my friend? You are very old now, and with whatever remains of your waning strength, you won’t be able to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. - ''' -import re -import collections -count=int() #int() 函数用于将一个字符串或数字转换为整型 -def stats_text_cn(text,count): - if not isinstance(text,str): - raise ValueError('type of argumengt is not str') - p=re.compile(u'[\u4e00-\u9fa5]') - a=re.findall(p,text) - str1=''.join(a) - return(collections.Counter(str1).most_common(count)) - #Counter为每个出现的英文单词计数,返回前count个词频最高的词及出现的次数. - #以int整数类型作为输出限制,使输出的元素count为整数。 -def stats_text_en(text,count): - if type(text) == str: - b=re.sub(r'[^A-Za-z]',' ',text) - list1=b.split() - return(collections.Counter(list1).most_common(count)) - else: - raise ValueError('type of argumengt is not str') -def stats_text(text,count): - if not isinstance(text,str): - raise ValueError('type of argumengt is not str') - stats_text_cn(text,count) - stats_text_en(text,count) -stats_text(text,count) - - - diff --git a/exercises/1901100005/d09/tang300.json b/exercises/1901100005/d09/tang300.json deleted file mode 100644 index 70477f9ee..000000000 --- a/exercises/1901100005/d09/tang300.json +++ /dev/null @@ -1,2236 +0,0 @@ -[ - { - "id": 1, - "contents": "孤鸿海上来,池潢不敢顾。\n侧见双翠鸟,巢在三珠树。\n矫矫珍木巅,得无金丸惧。\n美服患人指,高明逼神恶。\n今我游冥冥,弋者何所慕。", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之一" - }, - { - "id": 2, - "contents": "兰叶春葳蕤,桂华秋皎洁。\n欣欣此生意,自尔为佳节。\n谁知林栖者,闻风坐相悦。\n草木有本心,何求美人折?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之二" - }, - { - "id": 3, - "contents": "幽人归独卧,滞虑洗孤清。\n持此谢高鸟,因之传远情。\n日夕怀空意,人谁感至精?\n飞沈理自隔,何所慰吾诚?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之三" - }, - { - "id": 4, - "contents": "江南有丹橘,经冬犹绿林。\n岂伊地气暖,自有岁寒心。\n可以荐嘉客,奈何阻重深!\n运命惟所遇,循环不可寻。\n徒言树桃李,此木岂无阴?", - "type": "五言古诗", - "author": "张九龄", - "title": "感遇四首之四" - }, - { - "id": 5, - "contents": "暮从碧山下,山月随人归,\n却顾所来径,苍苍横翠微。\n相携及田家,童稚开荆扉。\n绿竹入幽径,青萝拂行衣。\n欢言得所憩,美酒聊共挥。\n长歌吟松风,曲尽河星稀。\n我醉君复乐,陶然共忘机。", - "type": "五言古诗", - "author": "李白", - "title": "下终南山过斛斯山人宿置酒" - }, - { - "id": 6, - "contents": "花间一壶酒,独酌无相亲。\n举杯邀明月,对影成三人。\n月既不解饮,影徒随我身。\n暂伴月将影,行乐须及春。\n我歌月徘徊,我舞影零乱。\n醒时同交欢,醉后各分散。\n永结无情游,相期邈云汉。", - "type": "五言古诗", - "author": "李白", - "title": "月下独酌" - }, - { - "id": 7, - "contents": "燕草如碧丝,秦桑低绿枝。\n当君怀归日,是妾断肠时。\n春风不相识,何事入罗帏?", - "type": "五言古诗", - "author": "李白", - "title": "春思" - }, - { - "id": 8, - "contents": "岱宗夫如何,齐鲁青未了。\n造化钟神秀,阴阳割昏晓。\n荡胸生层云,决眦入归鸟,\n会当凌绝顶,一览众山小。", - "type": "五言古诗", - "author": "杜甫", - "title": "望岳" - }, - { - "id": 9, - "contents": "人生不相见,动如参与商。\n今夕复何夕,共此灯烛光。\n少壮能几时,鬓发各已苍。\n访旧半为鬼,惊呼热中肠。\n焉知二十载,重上君子堂。\n昔别君未婚,儿女忽成行。\n怡然敬父执,问我来何方。\n问答乃未已,驱儿罗酒浆。\n夜雨剪春韭,新炊间黄粱。\n主称会面难,一举累十觞。\n十觞亦不醉,感子故意长。\n明日隔山岳,世事两茫茫。", - "type": "五言古诗", - "author": "杜甫", - "title": "赠卫八处士" - }, - { - "id": 10, - "contents": "绝代有佳人,幽居在空谷。\n自云良家子,零落依草木。\n关中昔丧乱,兄弟遭杀戮。\n官高何足论,不得收骨肉。\n世情恶衰歇,万事随转烛。\n夫婿轻薄儿,新人美如玉。\n合昏尚知时,鸳鸯不独宿。\n但见新人笑,那闻旧人哭!\n在山泉水清,出山泉水浊。\n侍婢卖珠回,牵萝补茅屋。\n摘花不插发,采柏动盈掬。\n天寒翠袖薄,日暮倚修竹。", - "type": "五言古诗", - "author": "杜甫", - "title": "佳人" - }, - { - "id": 11, - "contents": "死别已吞声,生别常恻恻。\n江南瘴疠地,逐客无消息。\n故人入我梦,明我长相忆。\n君今在罗网,何以有羽翼?\n恐非平生魂,路远不可测。\n魂来枫林青,魂返关塞黑。\n落月满屋梁,犹疑照颜色。\n水深波浪阔,无使蛟龙得。", - "type": "五言古诗", - "author": "杜甫", - "title": "梦李白二首之一" - }, - { - "id": 12, - "contents": "浮云终日行,游子久不至。\n三夜频梦君,情亲见君意。\n告归常局促,苦道来不易。\n江湖多风波,舟楫恐失坠。\n出门搔白首,若负平生志。\n冠盖满京华,斯人独憔悴。\n孰云网恢恢,将老身反累。\n千秋万岁名,寂寞身后事。", - "type": "五言古诗", - "author": "杜甫", - "title": "梦李白二首之二" - }, - { - "id": 13, - "contents": "下马饮君酒,问君何所之。\n君言不得意,归卧南山陲。\n但去莫复闻,白云无尽时。", - "type": "五言古诗", - "author": "王维", - "title": "送别" - }, - { - "id": 14, - "contents": "圣代无隐者,英灵尽来归。\n遂令东山客,不得顾采薇。\n既至金门远,孰云吾道非?\n江淮度寒食,京洛缝春衣。\n置酒长安道,同心与我违。\n行当浮桂棹,未几拂荆扉。\n远树带行客,孤城当落晖。\n吾谋适不用,勿谓知音稀。", - "type": "五言古诗", - "author": "王维", - "title": "送綦毋潜落第还乡" - }, - { - "id": 15, - "contents": "言入黄花川,每逐青溪水。\n随山将万转,趣途无百里。\n声喧乱石中,色静深松里。\n漾漾泛菱荇,澄澄映葭苇。\n我心素已闲,清川澹如此。\n请留盘石上,垂钓将已矣。", - "type": "五言古诗", - "author": "王维", - "title": "青溪" - }, - { - "id": 16, - "contents": "斜光照墟落,穷巷牛羊归。\n野老念牧童,倚杖候荆扉。\n雉[句隹]麦苗秀,蚕眠桑叶稀。\n田夫荷锄立,相见语依依。\n即此羡闲逸,怅然吟式微。", - "type": "五言古诗", - "author": "王维", - "title": "渭川田家" - }, - { - "id": 17, - "contents": "艳色天下重,西施宁久微。\n朝为越溪女,暮作吴宫妃。\n贱日岂殊众,贵来方悟稀。\n邀人傅脂粉,不自著罗衣。\n君宠益娇态,君怜无是非。\n当时浣纱伴,莫得同车归。\n持谢邻家子,效颦安可希!", - "type": "五言古诗", - "author": "王维", - "title": "西施咏" - }, - { - "id": 18, - "contents": "北山白云里,隐者自怡悦。\n相望始登高,心随雁飞灭。\n愁因薄暮起,兴是清秋发。\n时见归村人,沙行渡头歇。\n天边树若荠,江畔洲如月。\n何当载酒来,共醉重阳节。", - "type": "五言古诗", - "author": "孟浩然", - "title": "秋登兰山寄张五" - }, - { - "id": 19, - "contents": "山光忽西落,池月渐东上。\n散发乘夜凉,开轩卧闲敞。\n荷风送香气,竹露滴清响。\n欲取鸣琴弹,恨无知音赏。\n感此怀故人,中宵劳梦想。", - "type": "五言古诗", - "author": "孟浩然", - "title": "夏日南亭怀辛大" - }, - { - "id": 20, - "contents": "夕阳度西岭,群壑倏已暝。\n松月生夜凉,风泉满清听。\n樵人归欲尽,烟鸟栖初定。\n之子期宿来,孤琴候萝径。", - "type": "五言古诗", - "author": "孟浩然", - "title": "宿业师山房待丁大不至" - }, - { - "id": 21, - "contents": "高卧南斋时,开帷月初吐。\n清辉淡水木,演漾在窗户。\n苒苒几盈虚,澄澄变今古。\n美人清江畔,是夜越吟苦。\n千里其如何,微风吹兰杜。", - "type": "五言古诗", - "author": "王昌龄", - "title": "同从弟南斋玩月忆山阴崔少府" - }, - { - "id": 22, - "contents": "绝顶一茅茨,直上三十里。\n扣关无僮仆,窥室惟案几。\n若非巾柴车,应是钓秋水。\n差池不相见,黾勉空仰止。\n草色新雨中,松声晚窗里。\n及兹契幽绝,自足荡心耳。\n虽无宾主意,颇得清净理。\n兴尽方下山,何必待之子。", - "type": "五言古诗", - "author": "邱为", - "title": "寻西山隐者不遇" - }, - { - "id": 23, - "contents": "幽意无断绝,此去随所偶。\n晚风吹行舟,花路入溪口。\n际夜转西壑,隔山望南斗。\n潭烟飞溶溶,林月低向后。\n生事且弥漫,愿为持竿叟。", - "type": "五言古诗", - "author": "綦毋潜", - "title": "春泛若耶溪" - }, - { - "id": 24, - "contents": "清溪深不测,隐处唯孤云。\n松际露微月,清光犹为君。\n茅亭宿花影,药院滋苔纹。\n余亦谢时去,西山鸾鹤群。", - "type": "五言古诗", - "author": "常建", - "title": "宿王昌龄隐居" - }, - { - "id": 25, - "contents": "塔势如涌出,孤高耸天宫。\n登临出世界,磴道盘虚空。\n突兀压神州,峥嵘如鬼工。\n四角碍白日,七层摩苍穹。\n下窥指高鸟,俯听闻惊风。\n连山若波涛,奔凑如朝东。\n青槐夹驰道,宫馆何玲珑!\n秋色从西来,苍然满关中。\n五陵北原上,万古青蒙蒙。\n净理了可悟,胜因夙所宗。\n誓将挂冠去,觉道资无穷。", - "type": "五言古诗", - "author": "岑参", - "title": "与高适薛据登慈恩寺浮图" - }, - { - "id": 26, - "contents": "癸卯岁,西原贼入道州,焚烧杀掠,几尽而去。明年,贼又攻永州,破邵,不犯此\n州边鄙而退,岂力能制敌欤?盖蒙其伤怜而已!诸史何为忍苦征敛!故作诗一篇以\n示官吏。\n昔岁逢太平,山林二十年。\n泉源在庭户,洞壑当门前。\n井税有常期,日晏犹得眠。\n忽然遭时变,数岁亲戎旃。\n今来典斯郡,山夷又纷然。\n城小贼不屠,人贫伤可怜。\n是以陷邻境,此州独见全。\n使臣将王命,岂不如贼焉!\n令彼征敛者,迫之如火煎。\n谁能绝人命,以作时世贤。\n思欲委符节,引竿自刺船。\n将家就鱼麦,归老江湖边。", - "type": "五言古诗", - "author": "元结", - "title": "贼退示官吏并序" - }, - { - "id": 27, - "contents": "兵卫森画戟,宴寝凝清香。\n海上风雨至,逍遥池阁凉。\n烦疴近消散,嘉宾复满堂。\n自惭居处崇,未睹斯民康。\n理会是非遣,性达形迹忘。\n鲜肥属时禁,蔬果幸见尝。\n俯饮一杯酒,仰聆金玉章。\n神欢体自轻,意欲凌风翔。\n吴中盛文史,群彦今汪洋。\n方知大蕃地,岂曰财赋强。", - "type": "五言古诗", - "author": "韦应物", - "title": "郡斋雨中与诸文士燕集" - }, - { - "id": 28, - "contents": "凄凄去亲爱,泛泛入烟雾。\n归棹洛阳人,残钟广陵树。\n今朝为此别,何处还相遇。\n世事波上舟,沿洄安得住。", - "type": "五言古诗", - "author": "韦应物", - "title": "初发扬子寄元大校书" - }, - { - "id": 29, - "contents": "今朝郡斋冷,忽念山中客。\n涧底束荆薪,归来煮白石。\n欲持一瓢酒,远慰风雨夕。\n落叶满空山,何处寻行迹。", - "type": "五言古诗", - "author": "韦应物", - "title": "寄全椒山中道士" - }, - { - "id": 30, - "contents": "客从东方来,衣上灞陵雨。\n问客何为来,采山因买斧。\n冥冥花正开,扬扬燕新乳。\n昨别今已春,鬓丝生几缕。", - "type": "五言古诗", - "author": "韦应物", - "title": "长安遇冯著" - }, - { - "id": 31, - "contents": "落帆逗淮镇,停舫临孤驿。\n浩浩风起波,冥冥日沈夕。\n人归山郭暗,雁下芦洲白。\n独夜忆秦关,听钟未眠客。", - "type": "五言古诗", - "author": "韦应物", - "title": "夕次盱眙县" - }, - { - "id": 32, - "contents": "吏舍局终年,出郊旷清曙。\n杨柳散和风,青山澹吾虑。\n依丛适自憩,缘涧还复去。\n微雨霭芳原,春鸠鸣何处?\n乐幽心屡止,遵事迹犹遽。\n终罢斯结庐,慕陶真可庶。", - "type": "五言古诗", - "author": "韦应物", - "title": "东郊" - }, - { - "id": 33, - "contents": "永日方戚戚,出行复悠悠。\n女子今有行,大江溯轻舟。\n尔辈苦无恃,抚念益慈柔。\n幼为长所育,两别泣不休。\n对此结中肠,义往难复留!\n自小阙内训,事姑贻我忧。\n赖兹托令门,仁恤庶无尤。\n贫俭诚所尚,资从岂待周?\n孝恭遵妇道,容止顺其猷。\n别离在今晨,见尔当何秋。\n居闲始自遣,临感忽难收。\n归来视幼女,零泪缘缨流。", - "type": "五言古诗", - "author": "韦应物", - "title": "送杨氏女" - }, - { - "id": 34, - "contents": "汲井漱寒齿,清心拂尘服。\n闲持贝叶书,步出东斋读。\n真源了无取,忘迹世所逐。\n遗言冀可冥,缮性何由熟?\n道人庭宇静,苔色连深竹。\n日出雾露馀,青松如膏沐。\n澹然离言说,悟悦心自足。", - "type": "五言古诗", - "author": "柳宗元", - "title": "晨诣超师院读禅经" - }, - { - "id": 35, - "contents": "久为簪组累,幸此南夷谪。\n闲依农圃邻,偶似山林客。\n晓耕翻露草,夜榜响溪石。\n来往不逢人,长歌楚天碧。", - "type": "五言古诗", - "author": "柳宗元", - "title": "溪居" - }, - { - "id": 36, - "contents": "蝉鸣空桑林,八月萧关道。\n出塞复入塞,处处黄芦草。\n从来幽并客,皆向沙场老。\n莫学游侠儿,矜夸紫骝好。", - "type": "五言乐府", - "author": "王昌龄", - "title": "塞上曲" - }, - { - "id": 37, - "contents": "饮马渡秋水,水寒风似刀。\n平沙日未没,黯黯见临洮。\n昔日长城战,咸言意气高。\n黄尘足今古,白骨乱蓬蒿。", - "type": "五言乐府", - "author": "王昌龄", - "title": "塞下曲" - }, - { - "id": 38, - "contents": "明月出天山,苍茫云海间。\n长风几万里,吹度玉门关。\n汉下白登道,胡窥青海湾。\n由来征战地,不见有人还。\n戍客望边色,思归多苦颜。\n高楼当此夜,叹息未应闲。", - "type": "五言乐府", - "author": "李白", - "title": "关山月" - }, - { - "id": 39, - "contents": "秦地罗敷女,采桑绿水边。\n素手青条上,红妆白日鲜。\n蚕饥妾欲去,五马莫留连。", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:春歌" - }, - { - "id": 40, - "contents": "镜湖三百里,菡萏发荷花。\n五月西施采,人看隘若耶。\n回舟不待月,归去越王家。", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:夏歌" - }, - { - "id": 41, - "contents": "长安一片月,万户捣衣声。\n秋风吹不尽,总是玉关情。\n何日平胡虏,良人罢远征?", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:秋歌" - }, - { - "id": 42, - "contents": "明朝驿使发,一夜絮征袍。\n素手抽针冷,那堪把剪刀。\n裁缝寄远道,几日到临洮?", - "type": "五言乐府", - "author": "李白", - "title": "子夜四时歌:冬歌" - }, - { - "id": 43, - "contents": "妾发初覆额,折花门前剧。\n郎骑竹马来,绕床弄青梅。\n同居长干里,两小无嫌猜。\n十四为君妇,羞颜未尝开。\n低头向暗壁,千唤不一回。\n十五始展眉,愿同尘与灰。\n常存抱柱信,岂上望夫台!\n十六君远行,瞿塘滟预堆。\n五月不可触,猿鸣天上哀。\n门前迟行迹,一一生绿苔。\n苔深不能扫,落叶秋风早。\n八月蝴蝶来,双飞西园草。\n感此伤妾心,坐愁红颜老。\n早晚下三巴,预将书报家。\n相迎不道远,直至长风沙。", - "type": "五言乐府", - "author": "李白", - "title": "长干行" - }, - { - "id": 44, - "contents": "梧桐相待老,鸳鸯会双死。\n贞妇贵殉夫,舍生亦如此。\n波澜誓不起,妾心井中水。", - "type": "五言乐府", - "author": "孟郊", - "title": "烈女操" - }, - { - "id": 45, - "contents": "慈母手中线,游子身上衣。\n临行密密缝,意恐迟迟归。\n谁言寸草心,报得三春辉?", - "type": "五言乐府", - "author": "孟郊", - "title": "游子吟" - }, - { - "id": 46, - "contents": "前不见古人,后不见来者。\n念天地之悠悠,独怆然而涕下!", - "type": "五言乐府", - "author": "陈子昂", - "title": "登幽州台歌" - }, - { - "id": 47, - "contents": "男儿事长征,少小幽燕客。\n赌胜马蹄下,由来轻七尺。\n杀人莫敢前,须如猬毛磔。\n黄云陇底白雪飞,未得报恩不能归。\n辽东小妇年十五,惯弹琵琶解歌舞。\n今为羌笛出塞声,使我三军泪如雨!", - "type": "七言古诗", - "author": "李颀", - "title": "古意" - }, - { - "id": 48, - "contents": "四月南风大麦黄,枣花未落桐叶长。\n青山朝别暮还见,嘶马出门思故乡。\n陈侯立身何坦荡,虬须虎眉仍大颡。\n腹中贮书一万卷,不肯低头在草莽。\n东门酤酒饮我曹,心轻万事皆鸿毛。\n醉卧不知白日暮,有时空望孤云高。\n长河浪头连天黑,津口停舟渡不得。\n郑国游人未及家,洛阳行子空叹息。\n闻道故林相识多,罢官昨日今如何?", - "type": "七言古诗", - "author": "李颀", - "title": "送陈章甫" - }, - { - "id": 49, - "contents": "主人有酒欢今夕,请奏鸣琴广陵客。\n月照城头乌半飞,霜凄万树风入衣。\n铜炉华烛烛增辉,初弹渌水后楚妃。\n一声已动物皆静,四座无言星欲稀。\n清淮奉使千馀里,敢告云山从此始?", - "type": "七言古诗", - "author": "李颀", - "title": "琴歌" - }, - { - "id": 50, - "contents": "蔡女昔造胡笳声,一弹一十有八拍。\n胡人落泪沾边草,汉使断肠对归客。\n古戍苍苍烽火寒,大荒沈沈飞雪白。\n先拂声弦后角羽,四郊秋叶惊[扌戚][扌戚]。\n董夫子,通神明,深山窃听来妖精。\n言迟更速皆应手,将往复旋如有情。\n空山百鸟散还合,万里浮云阴且晴。\n嘶酸雏雁失群夜,断绝胡儿恋母声。\n川为静其波,鸟亦罢其鸣。\n乌孙部落家乡远,逻娑沙尘哀怨生。\n幽音变调忽飘洒,长风吹林雨堕瓦。\n迸泉飒飒飞木末,野鹿呦呦走堂下。\n长安城连东掖垣,凤凰池对青琐门。\n高才脱略名与利,日夕望君抱琴至。", - "type": "七言古诗", - "author": "李颀", - "title": "听董大弹胡笳声兼寄语弄房给事" - }, - { - "id": 51, - "contents": "南山截竹为筚篥,此乐本自龟兹出。\n流传汉地曲转奇,凉州胡人为我吹。\n傍邻闻者多叹息,远客思乡皆泪垂。\n世人解听不解赏,长飙风中自来往。\n枯桑老柏寒飕[风留],九雏鸣凤乱啾啾。\n龙吟虎啸一时发,万籁百泉相与秋。\n忽然更作渔阳掺,黄云萧条白日暗。\n变调如闻杨柳春,上林繁花照眼新。\n岁夜高堂列明烛,美酒一杯声一曲。", - "type": "七言古诗", - "author": "李颀", - "title": "听安万善吹筚篥歌" - }, - { - "id": 52, - "contents": "山寺钟鸣昼已昏,渔梁渡头争渡喧。\n人随沙路向江村,余亦乘舟归鹿门。\n鹿门月照开烟树,忽到庞公栖隐处。\n岩扉松径长寂寥,惟有幽人自来去。", - "type": "七言古诗", - "author": "孟浩然", - "title": "夜归鹿门山歌" - }, - { - "id": 53, - "contents": "我本楚狂人,凤歌笑孔丘。\n手持绿玉杖,朝别黄鹤楼。\n五岳寻仙不辞远,一生好入名山游。\n庐山秀出南斗傍,屏风九叠云锦张。\n影落明湖青黛光,金阙前开二峰长。\n银河倒挂三石梁,香炉瀑布遥相望。\n回崖沓障凌苍苍。\n翠影红霞映朝日,鸟飞不到吴天长。\n登高壮观天地间,大江茫茫去不黄。\n黄云万里动风色,白波九道流雪山。\n好为庐山谣,兴因庐山发。\n闲窥石镜清我心,谢公行处苍苔没。\n早服还丹无世情,琴心三叠道初成。\n遥见仙人彩云里,手把芙蓉朝玉京。\n先期汗漫九垓上,愿接卢敖游太清。", - "type": "七言古诗", - "author": "李白", - "title": "庐山谣寄卢侍御虚舟" - }, - { - "id": 54, - "contents": "海客谈瀛洲,烟涛微茫信难求。\n越人语天姥,云霓明灭或可睹。\n天姥连天向天横,势拔五岳掩赤城。\n天台四万八千丈,对此欲倒东南倾。\n我欲因之梦吴越,一夜飞渡镜湖月。\n湖月照我影,送我至剡溪。\n谢公宿处今尚在,渌水荡漾清猿啼。\n脚著谢公屐,身登青云梯。\n半壁见海日,空中闻天鸡。\n千岩万壑路不定,迷花倚石忽已暝。\n熊咆龙吟殷岩泉,栗深林兮惊层巅。\n云青青兮欲雨,水澹澹兮生烟。\n裂缺霹雳,丘峦崩摧。\n洞天石扇,訇然中开。\n青冥浩荡不见底,日月照耀金银台。\n霓为衣兮风为马,云之君兮纷纷而来下。\n虎鼓瑟兮鸾回车,仙之人兮列如麻。\n忽魂悸以魄动,恍惊起而长嗟。\n惟觉时之枕席,失向来之烟霞。\n世间行乐亦如此,古来万事东流水。\n别君去兮何时还?且放白鹿青崖间。\n须行即骑访名山。\n安能摧眉折腰事权贵,使我不得开心颜!", - "type": "七言古诗", - "author": "李白", - "title": "梦游天姥吟留别" - }, - { - "id": 55, - "contents": "风吹柳花满店香,吴姬压酒唤客尝。\n金陵子弟来相送,欲行不行各尽觞。\n请君试问东流水,别意与之谁短长?", - "type": "七言古诗", - "author": "李白", - "title": "金陵酒肆留别" - }, - { - "id": 56, - "contents": "弃我去者,昨日之日不可留。\n乱我心者,今日之日多烦忧!\n长风万里送秋雁,对此可以酣高楼。\n蓬莱文章建安骨,中间小谢又清发。\n俱怀逸兴壮思飞,欲上青天览明月。\n抽刀断水水更流,举杯销愁愁更愁。\n人生在世不称意,明朝散发弄扁舟。", - "type": "七言古诗", - "author": "李白", - "title": "宣州谢[月兆]楼饯别校书叔云" - }, - { - "id": 57, - "contents": "君不见走马川行雪海边,平沙莽莽黄入天。\n轮台九月风夜吼,一川碎石大如斗。\n随风满地石乱走,匈奴草黄马正肥。\n金山西见烟尘飞,汉家大将西出师。\n将军金甲夜不脱,半夜军行戈相拨。\n风头如刀面如割,马毛带雪汗气蒸。\n五花连钱旋作冰,幕中草檄砚水凝。\n虏骑闻之应胆慑,料知短兵不敢接。\n车师西门伫献捷!", - "type": "七言古诗", - "author": "岑参", - "title": "走马川行奉送封大夫出师西征" - }, - { - "id": 58, - "contents": "轮台城头夜吹角,轮台城北旄头落。\n羽书昨夜过渠黎,单于已在金山西。\n戍楼西望烟尘黑,汉兵屯在轮台北。\n上将拥旄西出征,平明吹笛大军行。\n四边伐鼓雪海涌,三军大呼阴山动。\n虏塞兵气连云屯,战场白骨缠草根。\n剑河风急雪片阔,沙口石冻马蹄脱。\n亚相勤王甘苦辛,誓将报主静边尘。\n古来青史谁不见,今见功名胜古人。", - "type": "七言古诗", - "author": "岑参", - "title": "轮台歌奉送封大夫出师西征" - }, - { - "id": 59, - "contents": "北风卷地白草折,胡天八月即飞雪。\n忽如一夜春风来,千树万树梨花开。\n散入珠帘湿罗幕,狐裘不暖锦衾薄。\n将军角弓不得控,都护铁衣冷犹著。\n瀚海阑干百丈冰,愁云黪淡万里凝。\n中军置酒饮归客,胡琴琵琶与羌笛。\n纷纷暮雪下辕门,风掣红旗冻不翻。\n轮台东门送君去,去时雪满天山路。\n山回路转不见君,雪上空留马行处。", - "type": "七言古诗", - "author": "岑参", - "title": "白雪歌送武判官归京" - }, - { - "id": 60, - "contents": "国初以来画鞍马,神妙独数江都王。\n将军得名三十载,人间又见真乘黄。\n曾貌先帝照夜白,龙池十日飞霹雳。\n内府殷红玛瑙盘,婕妤传诏才人索。\n盘赐将军拜舞归,轻纨细绮相追飞。\n贵戚权门得笔迹,始觉屏障生光辉。\n昔日太宗拳毛[马呙],近时郭家狮子花。\n今之新图有二马。复令识者久叹嗟。\n此皆骑战一敌万,缟素漠漠开风沙。\n其余七匹亦殊绝,迥若寒空杂烟雪。\n霜蹄蹴踏长楸间,马官厮养森成列。\n可怜九马争神骏,顾视清高气深稳。\n借问苦心爱者谁,后有韦讽前支盾。\n忆昔巡幸新丰宫,翠花拂天来向东。\n腾骧磊落三万匹,皆与此图筋骨同。\n自从献宝朝河宗,无复射蛟江水中。\n君不见,金粟堆前松柏里。龙媒去尽鸟呼风。", - "type": "七言古诗", - "author": "杜甫", - "title": "韦讽录事宅观曹将军画马图" - }, - { - "id": 61, - "contents": "将军魏武之子孙,于今为庶为青门。\n英雄割据虽已矣,文采风流今尚存。\n学书初学卫夫人,但恨无过王右军。\n丹青不知老将至,富贵于我如浮云。\n开元之中常引见,承恩数上南熏殿。\n凌烟功臣少颜色,将军下笔开生面。\n良相头上进贤冠,猛将腰间大羽箭。\n褒公鄂公毛发动,英姿飒爽犹酣战。\n先帝天马玉花骢,画工如山貌不同。\n是日牵来赤墀下,迥立阊阖生长风。\n诏谓将军拂绢素,意匠惨淡经营中。\n斯须九重真龙出,一洗万古凡马空。\n玉花却在御榻上,榻上庭前屹相向。\n至尊含笑催赐金,圉人太仆皆惆怅。\n弟子韩干早入室,亦能画马穷殊相。\n干惟画肉不画骨,忍使骅骝气凋丧。\n将军画善盖有神,偶逢佳士亦写真。\n即今漂泊干戈际,屡貌寻常行路人。\n涂穷反遭俗眼白,世上未有如公贫。\n但看古来盛名下,终日坎[土禀]缠其身!", - "type": "七言古诗", - "author": "杜甫", - "title": "丹青引赠曹霸将军" - }, - { - "id": 62, - "contents": "今我不乐思岳阳,身欲奋飞病在床。\n美人娟娟隔秋水,濯足洞庭望八荒。\n鸿飞冥冥日月白,青枫叶赤天雨霜。\n玉京群帝集北斗,或骑麒麟翳凤凰。\n芙蓉旌旗烟雾落,影动倒景摇潇湘。\n星宫之君醉琼浆,羽人稀少不在旁。\n似闻昨者赤松子,恐是汉代韩张良。\n昔随刘氏定长安,帷幄未改神惨伤。\n国家成败吾岂敢,色难腥腐餐枫香。\n周南留滞古所惜,南极老人应寿昌。\n美人胡为隔秋水,焉得置之贡玉堂?", - "type": "七言古诗", - "author": "杜甫", - "title": "寄韩谏议" - }, - { - "id": 63, - "contents": "孔明庙前有老柏,柯如青铜根如石。\n双皮溜雨四十围,黛色参天二千尺。\n君臣已与时际会,树木犹为人爱惜。\n云来气接巫峡长,月出寒通雪山白。\n忆昨路绕锦亭东,先主武侯同[门必]宫。\n崔嵬枝干郊原古,窈窕丹青户牖空。\n落落盘踞虽得地,冥冥孤高多烈风。\n扶持自是神明力,正直元因造化功。\n大厦如倾要梁栋,万牛回首丘山重。\n不露文章世已惊,未辞剪伐谁能送?\n苦心岂免容蝼蚁?香叶终经宿鸾凤。\n志士幽人莫怨嗟,古来材大难为用!", - "type": "七言古诗", - "author": "杜甫", - "title": "古柏行" - }, - { - "id": 64, - "contents": "大历二年十月十九日夔府别驾元持宅见临颍李十二娘舞剑器,壮其蔚[足支]。问\n其所师,曰:余公孙大娘弟子也。开元三载,余尚童稚,记于郾城观公孙氏舞剑器\n浑脱。浏漓顿挫,独出冠时。自高头宜春梨园二伎坊内人,洎外供奉,晓是舞者,\n圣文神武皇帝初,公孙一人而已。玉貌锦衣,况余白首!今兹弟子亦匪盛颜。既辨\n其由来,知波澜莫二。抚事慷慨,聊为剑器行。昔者吴人张旭善草书书帖,数尝於\n邺县见公孙大娘舞西河剑器,自此草书长进,豪荡感激。即公孙可知矣!\n昔有佳人公孙氏,一舞剑器动四方。\n观者如山色沮丧,天地为之久低昂。\n霍如羿射九日落,矫如群帝骖龙翔。\n来如雷霆收震怒,罢如江海凝清光。\n绛唇珠袖两寂寞,晚有弟子传芬芳。\n临颍美人在白帝,妙舞此曲神扬扬。\n与余问答既有以,感时抚事增惋伤。\n先帝侍女八千人,公孙剑器初第一。\n五十年间似反掌,风尘[氵项]洞昏王室。\n梨园子弟散如烟,女乐馀姿映寒日。\n金粟堆前木已拱,瞿塘石城草萧瑟。\n玳筵急管曲复终,乐极哀来月东出。\n老夫不知其所往,足茧荒山转愁疾。", - "type": "七言古诗", - "author": "杜甫", - "title": "观公孙大娘弟子舞剑器行并序" - }, - { - "id": 65, - "contents": "漫叟以公田米酿酒,因休暇,则载酒于湖上,\n时取一醉;欢醉中,据湖岸,引臂向鱼取酒,\n使舫载之,遍饮坐者。意疑倚巴丘,酌於君山\n之上,诸子环洞庭而坐,酒舫泛泛然,触波涛\n而往来者,乃作歌以长之。\n石鱼湖,似洞庭,夏水欲满君山青。\n山为樽,水为沼,酒徒历历坐洲鸟。\n长风连日作大浪,不能废人运酒舫。\n我持长瓢坐巴丘,酌饮四座以散愁。", - "type": "七言古诗", - "author": "元结", - "title": "石鱼湖上醉歌并序" - }, - { - "id": 66, - "contents": "山石荦确行径微,黄昏到寺蝙蝠飞。\n升堂坐阶新雨足,芭蕉叶大栀子肥。\n僧言古壁佛画好,以火来照所见稀。\n铺床拂席置羹饭,疏粝亦足饱我饥。\n夜深静卧百虫绝,清月出岭光入扉。\n天明独去无道路,出入高下穷烟霏。\n山红涧碧纷烂漫,时见松枥皆十围。\n当流赤足蹋涧石,水声激激风吹衣。\n人生如此自可乐,岂必局束为人[革几]!\n嗟哉吾党二三子,安得至老不更归!", - "type": "七言古诗", - "author": "韩愈", - "title": "山石" - }, - { - "id": 67, - "contents": "纤云四卷天无河,清风吹空月舒波。\n沙平水息声影绝,一杯相属君当歌。\n君歌声酸辞且苦,不能听终泪如雨。\n洞庭连天九嶷高,蛟龙出没猩鼯号。\n十生九死到官所,幽居默默如藏逃。\n下床畏蛇食畏药,海气湿蛰熏腥臊。\n昨者州前槌大鼓,嗣皇继圣登夔皋。\n赦书一日行万里,罪从大辟皆除死。\n迁者追回流者还,涤瑕荡垢清朝班。\n州家申名使家抑,坎轲只得移荆蛮。\n判司卑官不堪说,未免捶楚尘埃间。\n同时辈流多上道,天路幽险难追攀。\n君歌且休听我歌,我歌今与君殊科。\n一年明月今宵多,人生由命非由他。\n有酒不饮奈明何!", - "type": "七言古诗", - "author": "韩愈", - "title": "八月十五夜赠张功曹" - }, - { - "id": 68, - "contents": "五岳祭秩皆三公,四方环镇嵩当中。\n火维地荒足妖怪,天假神柄专其雄。\n喷云泄雾藏半腹,虽有绝顶谁能穷?\n我来正逢秋雨节,阴气晦昧无清风。\n潜心默祷若有应,岂非正直能感通!\n须臾静扫众峰出,仰见突兀撑青空。\n紫盖连延接天柱,石廪腾掷堆祝融。\n森然魄动下马拜,松柏一迳趋灵宫。\n纷墙丹柱动光彩,鬼物图画填青红。\n升阶伛偻荐脯酒,欲以菲薄明其衷。\n庙内老人识神意,睢盱侦伺能鞠躬。\n手持杯[王交]导我掷,云此最吉馀难同。\n窜逐蛮荒幸不死,衣食才足甘长终。\n侯王将相望久绝,神纵欲福难为功!\n夜投佛寺上高阁,星月掩映云[日童][日龙]。\n猿鸣钟动不知曙,杲杲寒日生于东。", - "type": "七言古诗", - "author": "韩愈", - "title": "谒衡岳庙遂宿岳寺题门楼" - }, - { - "id": 69, - "contents": "张生手持石鼓文,劝我识作石鼓歌。\n少陵无人谪仙死,才薄将奈石鼓何!\n周纲凌迟四海沸,宣王愤起挥天戈。\n大开明堂受朝贺,诸侯剑佩鸣相磨。\n搜于岐阳骋雄俊,万里禽兽皆遮罗。\n镌功勒成告万世,凿石作鼓隳嵯峨。\n从臣才艺咸第一,拣选撰刻留山阿。\n雨淋日炙野火燎,鬼物守护烦[扌为]呵。\n公从何处得纸本?毫发尽备无差讹。\n辞严义密读难晓,字体不类隶与蝌。\n年深岂免有缺画,快剑砍断生蛟鼍。\n鸾翔凤翥众仙下,珊瑚碧树交枝柯。\n金绳铁索锁钮壮,古鼎跃水龙腾梭。\n陋儒编诗不收入,二雅褊迫无委蛇。\n孔子西行不到秦,掎摭星宿遗羲娥。\n嗟予好古生苦晚,对此涕泪双滂沱。\n忆昔初蒙博士征,其年始改称元和。\n故人从军在右辅,为我度量掘臼科。\n濯冠沐浴告祭酒,如此至宝存岂多!\n毡包席裹可立致,十鼓只载数骆驼。\n荐诸太庙比郜鼎,光价岂止百倍过!\n圣恩若许留太学,诸生讲解得切磋。\n观经鸿都尚填咽,坐见举国来奔波。\n剜苔剔藓露节角,安置妥帖平不颇。\n大厦深檐与盖覆,经历久远期无佗。\n中朝大官老于事,讵肯感激徒□(“妍”右上一横改为“合”)婀。\n牧童敲火牛砺角,谁复著手为摩挲?\n日销月铄就埋没,六年西顾空吟哦。\n羲之俗书趁姿媚,数纸尚可博白鹅。\n继周八代争战罢,无人收拾理则那。\n方今太平日无事,柄任儒术崇丘轲。\n安能以此上论列,愿借辩口如悬河。\n石鼓之歌止于此,呜呼吾意其蹉跎!", - "type": "七言古诗", - "author": "韩愈", - "title": "石鼓歌" - }, - { - "id": 70, - "contents": "渔翁夜傍西岩宿,晓汲清湘燃楚烛。\n烟销日出不见人,[矣欠]乃一声山水绿。\n回看天际下中流,岩上无心云相逐。", - "type": "七言古诗", - "author": "柳宗元", - "title": "渔翁" - }, - { - "id": 71, - "contents": "汉皇重色思倾国,御宇多年求不得。\n杨家有女初长成,养在深闺人未识。\n天生丽质难自弃,一朝选在君王侧。\n回眸一笑百媚生,六宫粉黛无颜色。\n春寒赐浴华清池,温泉水滑洗凝脂。\n侍儿扶起娇无力,始是新承恩泽时。\n云鬓花颜金步摇,芙蓉帐暖度春宵。\n春宵苦短日高起,从此君王不早朝。\n承欢侍宴无闲暇,春从春游夜专夜。\n后宫佳丽三千人,三千宠爱在一身。\n金星妆成娇侍夜,玉楼宴罢醉和春。\n姊妹弟兄皆列士,可怜光彩生门户。\n遂令天下父母心,不重生男重生女。\n骊宫高处入青云,仙乐风飘处处闻。\n缓歌慢舞凝丝竹,尽日君王看不足。\n渔阳鼙鼓动地来,惊破霓裳羽衣曲。\n九重城阙烟尘生,千乘万骑西南行。\n翠华摇摇行复止,西出都门百馀里。\n六军不发无奈何,宛转蛾眉马前死。\n花钿委地无人收,翠翘金雀玉搔头。\n君王掩面救不得,回看血泪相和流。\n黄埃散漫风萧索,云栈萦纡登剑阁。\n峨嵋山下少人行,旌旗无光日色薄。\n蜀江水碧蜀山青,圣主朝朝暮暮情。\n行宫见月伤心色,夜雨闻铃肠断声。\n天旋地转回龙驭,到此踌躇不能去。\n马嵬坡下泥土中,不见玉颜空死处。\n君臣相顾尽沾衣,东望都门信马归。\n归来池苑皆依旧,太液芙蓉未央柳。\n芙蓉如面柳如眉,对此如何不泪垂!\n春风桃李花开日,秋雨梧桐叶落时。\n西宫南内多秋草,落叶满阶红不扫。\n梨园子弟白发新,椒房阿监青娥老。\n夕殿萤飞思悄然,孤灯挑尽未成眠。\n迟迟钟鼓初长夜,耿耿星河欲曙天。\n鸳鸯瓦冷霜华重,翡翠衾寒谁与共?\n悠悠生死别经年,魂魄不曾来入梦。\n临邛道士鸿都客,能以精诚致魂魄。\n为感君王辗转思,遂教方士殷勤觅。\n排空驭气奔如电,升天入地求之遍。\n上穷碧落下黄泉,两处茫茫皆不见。\n忽闻海上有仙山,山在虚无缥缈间。\n楼阁玲珑五云起,其中绰约多仙子。\n中有一人字太真,雪肤花貌参差是。\n金阙西厢叩玉扃,转教小玉报双成。\n闻道汉家天子使,九华帐里梦魂惊。\n揽衣推枕起徘徊,珠箔银屏迤逦开。\n云鬓半偏新睡觉,花冠不整下堂来。\n风吹仙袂飘飘举,犹似霓裳羽衣舞。\n玉容寂寞泪阑干,梨花一枝春带雨。\n含情凝睇谢君王,一别音容两渺茫。\n昭阳殿里恩爱绝,蓬莱宫中日月长。\n回头下望人寰处,不见长安见尘雾。\n唯将旧物表深情,钿合金钗寄将去。\n钗留一股合一扇,钗擘黄金合分钿。\n但教心似金钿坚,天上人间会相见。\n临别殷勤重寄词,词中有誓两心知。\n七月七日长生殿,夜半无人私语时。\n在天愿作比翼鸟,在地愿为连理枝。\n天长地久有时尽,此恨绵绵无绝期!", - "type": "七言古诗", - "author": "白居易", - "title": "长恨歌" - }, - { - "id": 72, - "contents": "元和十年,予左迁九江郡司马。明年秋,送客湓浦口,闻船中夜弹琵琶者,听其音\n,铮铮然有京都声;问其人,本长安倡女,尝学琵琶於穆曹二善才。年长色衰,委\n身为贾人妇。遂命酒,使快弹数曲,曲罢悯然。自叙少小时欢乐事,今漂沦憔悴,\n转徙於江湖间。予出官二年恬然自安,感斯人言,是夕,始觉有迁谪意,因为长句\n歌以赠之,凡六百一十六言,命曰琵琶行。\n浔言江头夜送客,枫叶荻花秋瑟瑟。\n主人下马客在船,举酒欲饮无管弦。\n醉不成欢惨将别,别时茫茫江浸月。\n忽闻水上琵琶声,主人忘归客不发。\n寻声暗问弹者谁,琵琶声停欲语迟。\n移船相近邀相见,添酒回灯重开宴。\n千呼万唤始出来,犹抱琵琶半遮面。\n转轴拨弦三两声,未成曲调先有情。\n弦弦掩抑声声思,似诉平生不得志。\n低眉信手续续弹,说尽心中无限事。\n轻拢慢捻抹复挑,初为霓裳后六么。\n大弦嘈嘈如急雨,小弦切切如私语。\n嘈嘈切切错杂弹,大珠小珠落玉盘。\n间关莺语花底滑,幽咽泉流水下滩。\n水泉冷涩弦凝绝,凝绝不通声渐歇。\n别有幽愁暗恨生,此时无声胜有声。\n银瓶乍破水浆迸,铁骑突出刀枪鸣。\n曲终收拨当心画,四弦一声如裂帛。\n东船西舫悄无言,唯见江心秋月白。\n沈吟放拨插弦中,整顿衣裳起敛容。\n自言本是京城女,家在虾蟆陵下住。\n十三学得琵琶成,名属教坊第一部。\n曲罢曾教善才服,妆成每被秋娘妒。\n五陵年少争缠头,一曲红绡不知数。\n钿头银篦击节碎,血色罗裙翻酒污。\n今年欢笑复明年,秋月春风等闲度。\n弟走从军阿姨死,暮去朝来颜色故。\n门前冷落车马稀,老大嫁作商人妇。\n商人重利轻别离,前月浮梁买茶去。\n去来江口守空船,绕船月明江水寒。\n夜深忽梦少年事,梦啼妆泪红阑干。\n我闻琵琶已叹息,又闻此语重唧唧。\n同是天涯沦落人,相逢何必曾相识!\n我从去年辞帝京,谪居卧病浔阳城。\n浔阳地僻无音乐,终岁不闻丝竹声。\n住近湓江地低湿,黄芦苦竹绕宅生。\n其间旦暮闻何物?杜鹃啼血猿哀鸣。\n春江花朝秋月夜,往往取酒还独倾。\n岂无山歌与村笛,呕哑嘲哳难为听!\n今夜闻君琵琶语,如听仙乐耳暂明。\n莫辞更坐弹一曲,为君翻作琵琶行。\n感我此言良久立,却坐促弦弦转急。\n凄凄不似向前声,满座重闻皆掩泣。\n座中泣下谁最多,江州司马青衫湿!", - "type": "七言古诗", - "author": "白居易", - "title": "琵琶行并序" - }, - { - "id": 73, - "contents": "元和天子神武姿,彼何人哉轩与羲。\n誓将上雪列圣耻,坐法宫中朝四夷。\n淮西有贼五十载,封狼生[豸区][豸区]生罴。\n不据山河据平地,长戈利矛日可麾。\n帝得圣相相曰度,贼斫不死神扶持。\n腰悬相印作都统,阴风惨澹天王旗。\n□(上朔下心]武古通作牙爪,仪曹外郎载笔随。\n行军司马智且勇,十四万众犹虎貔。\n入蔡缚贼献太庙,功无与让恩不訾。\n帝曰汝度功第一,汝从事愈宜为辞。\n愈拜稽首蹈且舞,金石刻画臣能为。\n古者世称大手笔,此事不系于职司。\n当仁自古有不让,言讫屡颔天子颐。\n公退斋戒坐小阁,濡染大笔何淋漓!\n点窜尧典舜典字,涂改清庙生民诗。\n文成破体书在纸,清晨再拜铺丹墀。\n表曰臣愈昧死上,咏神圣功书之碑。\n碑高三丈字如斗,负以灵鳌蟠以螭。\n句奇语重喻者少,谗之天子言其私。\n长绳百尺拽碑倒,粗沙大石相磨治。\n公之斯文若元气,先时已入人肝脾。\n汤盘孔鼎有述作,今无其器存其辞。\n呜呼圣皇及圣相,相与[火亘]赫流淳熙。\n公之斯文不示后,曷与三五相攀追。\n愿书万本诵万过,口角流沫右手胝。\n传之七十有二代,以为封禅玉检明堂基。", - "type": "七言古诗", - "author": "李商隐", - "title": "韩碑" - }, - { - "id": 74, - "contents": "开元二十六年,客有从御史大夫张公出塞而还者,作燕歌行以示适,感征戍之事,\n因而和焉。\n汉家烟尘在东北,汉将辞家破残贼。\n男儿本自重横行,天子非常赐颜色。\n[扌从]金伐鼓下榆关,旌旆逶迤碣石间。\n校尉羽书飞瀚海,单于猎火照狼山。\n山川萧条极边土,胡骑凭陵杂风雨。\n战士军前半死生,美人帐下犹歌舞。\n大漠穷秋塞草衰,孤城落日斗兵稀。\n身当恩遇常轻敌,力尽关山未解围。\n铁衣远戍辛勤久,玉筋应啼别离后。\n少妇城南欲断肠,征人蓟北空回首。\n边庭飘摇那可度,绝域苍茫更何有!\n杀气三时作阵云,寒声一夜传刁斗。\n相看白刃血纷纷,死节从来岂顾勋?\n君不见沙场征战苦,至今犹忆李将军!", - "type": "七言乐府", - "author": "高适", - "title": "燕歌行并序" - }, - { - "id": 75, - "contents": "白日登山望烽火,黄昏饮马傍交河。\n行人刁斗风沙暗,公主琵琶幽怨多。\n野云万里无城郭,雨雪纷纷连大漠。\n胡雁哀鸣夜夜飞,胡儿眼泪双双落。\n闻道玉门犹被遮,应将性命逐轻车。\n年年战骨埋荒外,空见葡萄入汉家。", - "type": "七言乐府", - "author": "李颀", - "title": "古从军行" - }, - { - "id": 76, - "contents": "洛阳女儿对门居,才可容颜十五馀。\n良人玉勒乘骢马,侍女金盘脍鲤鱼。\n画阁朱楼尽相望,红桃绿柳垂檐向。\n罗帷送上七香车,宝扇迎归九华帐。\n狂夫富贵在青春,意气骄奢剧季伦。\n自怜碧玉亲教舞,不惜珊瑚持与人。\n春窗曙灭九微火,九微片片飞花琐。\n戏罢曾无理曲时,妆成只是薰香坐。\n城中相识尽繁华,日夜经过赵李家。\n谁怜越女颜如玉,贫贱江头自浣纱!", - "type": "七言乐府", - "author": "王维", - "title": "洛阳女儿行" - }, - { - "id": 77, - "contents": "少年十五二十时,步行夺得胡马骑。\n射杀山中白额虎,肯数邺下黄须儿!\n一身转战三千里,一剑曾当百万师。\n汉兵奋迅如霹雳,虏骑崩腾畏蒺藜。\n卫青不败由天幸,李广无功缘数奇。\n自从弃置便衰朽,世事蹉跎成白首。\n昔时飞箭无全目,今日垂杨生左肘。\n路旁时卖故侯瓜,门前学种先生柳。\n苍茫古木连穷巷,寥落寒山对虚牖。\n誓令疏勒出飞泉,不似颍川空使酒。\n贺兰山下阵如云,羽檄交驰日夕闻。\n节使三河募年少,诏书五道出将军。\n试拂铁衣如雪色,聊持宝剑动星文。\n愿得燕弓射大将,耻令越甲鸣吾君。\n莫嫌旧日云中守,犹堪一战取功勋!", - "type": "七言乐府", - "author": "王维", - "title": "老将行" - }, - { - "id": 78, - "contents": "渔舟逐水爱山春,两岸桃花夹古津。\n坐看红树不知远,行尽青溪不见人。\n山口潜行始隈[阝奥],山开旷望旋平陆。\n遥看一处攒云树,近入千家散花竹。\n樵客初传汉姓名,居人未改秦衣服。\n居人共住武陵源,还从物外起田园。\n月明松下房栊静,日出云中鸡犬喧。\n惊闻俗客争来集,竞引还家问都邑。\n平明闾巷扫花开,薄暮渔樵乘水入。\n初因避地去人间,及至成仙遂不还。\n峡里谁知有人事?世中遥望空云山。\n不疑灵境难闻见,尘心未尽思乡县。\n出洞无论隔山水,辞家终拟长游衍。\n自谓经过旧不迷,安知峰壑今来变?\n当时只记入山深,青溪几曲到云林。\n春来遍是桃花水,不辨仙源何处寻。", - "type": "七言乐府", - "author": "王维", - "title": "桃源行" - }, - { - "id": 79, - "contents": "噫吁戏,危乎高哉!\n蜀道之难难于上青天!\n蚕丛及鱼凫,开国何茫然!\n尔来四万八千岁,始与秦塞通人烟。\n西当太白有鸟道,可以横绝峨眉巅。\n地崩山摧壮士死,然后天梯石栈方钩连。\n上有六龙回日之高标,下有冲波逆折之回川。\n黄鹤之飞尚不得,猿猱欲度愁攀援。\n青泥何盘盘,百步九折萦岩峦。\n扪参历井仰胁息,以手抚膺坐长叹。\n问君西游何时还?畏途□(繁体“谗”换山旁)岩不可攀!\n但见悲鸟号古木,雄飞雌从绕林间。\n又闻子规啼,夜月愁空山。\n蜀道之难难于上青天!使人听此凋朱颜。\n连峰去天不盈尺,枯松倒挂倚绝壁。\n飞湍瀑流争喧[兀豕],冰崖转石万壑雷。\n其险也如此!\n嗟尔远道之人,胡为乎来哉?\n剑阁峥嵘而崔嵬。\n一夫当关,万夫莫开。\n所守或匪亲,化为狼与豺。\n朝避猛虎,夕避长蛇。\n磨牙吮血,杀人如麻。\n锦城虽云乐,不如早还家。\n蜀道之难难于上青天!侧身西望常咨嗟!", - "type": "七言乐府", - "author": "李白", - "title": "蜀道难" - }, - { - "id": 80, - "contents": "长相思,在长安。\n络纬秋啼金井阑,微霜凄凄簟色寒。\n孤灯不明思欲绝,卷帷望月空长叹。\n美人如花隔云端。\n上有青冥之长天,下有渌水之波澜。\n天长路远魂飞苦,梦魂不到关山难。\n长相思,摧心肝!", - "type": "七言乐府", - "author": "李白", - "title": "长相思二首之一" - }, - { - "id": 81, - "contents": "日色已尽花含烟,月明欲素愁不眠。\n赵瑟初停凤凰柱,蜀琴欲奏鸳鸯弦。\n此曲有意无人传,愿随春风寄燕然。\n忆君迢迢隔青天。\n昔日横波目,今成流泪泉。\n不信妾肠断,归来看取明镜前。", - "type": "七言乐府", - "author": "李白", - "title": "长相思二首之二" - }, - { - "id": 82, - "contents": "金樽清酒斗十千,玉盘珍羞值万钱。\n停杯投箸不能食,拔剑四顾心茫然。\n欲渡黄河冰塞川,将登太行雪满山。\n闲来垂钓碧溪上,忽复乘舟梦日边。\n行路难,行路难!多歧路,今安在?\n长风破浪会有时,直挂云帆济沧海。", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之一" - }, - { - "id": 83, - "contents": "大道如青天,我独不得出。\n羞逐长安社中儿,赤鸡白狗赌梨栗。\n弹剑作歌奏苦声,曳裾王门不称情。\n淮阴市井笑韩信,汉朝公卿忌贾生。\n君不见,昔时燕家重郭隗,拥彗折节无嫌猜\n剧辛乐毅感恩分,输肝剖胆效英才。\n昭王白骨萦蔓草,谁人更扫黄金台?\n行路难,归去来!", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之二" - }, - { - "id": 84, - "contents": "有耳莫洗颍川水,有口莫食首阳蕨。\n含光混世贵无名,何用孤高比云月?\n吾观自古贤达人,功成不退皆殒身。\n子胥既弃吴江上,屈原终投湘水滨。\n陆机雄才岂自保?李斯税驾苦不早。\n华亭鹤唳讵可闻,上蔡苍鹰何足道!\n君不见,吴中张翰称达生,秋风忽忆江东行。\n且乐生前一杯酒,何须身后千载名!", - "type": "七言乐府", - "author": "李白", - "title": "行路难三首之三" - }, - { - "id": 85, - "contents": "君不见,黄河之水天上来,奔流到海不复回。\n君不见,高堂明镜悲白发,朝如青丝暮成雪。\n人生得意须尽欢,莫使金樽空对月!\n天生我材必有用,千金散尽还复来。\n烹羊宰牛且为乐,会须一饮三百杯!\n岑夫子,丹丘生,将进酒,君莫停!\n与君歌一曲,请君为我侧耳听!\n钟鼓馔玉不足贵,但愿长醉不愿醒!\n古来圣贤皆寂寞,惟有饮者留其名!\n陈王昔时宴平乐,斗酒十千恣欢谑。\n主人何为言少钱?径须沽取对君酌。\n五花马,千金裘,呼儿将出换美酒,与尔同消万古愁!", - "type": "七言乐府", - "author": "李白", - "title": "将进酒" - }, - { - "id": 86, - "contents": "车辚辚,马萧萧,行人弓箭各在腰。\n耶娘妻子走相送,尘埃不见咸阳桥。\n牵衣顿足拦道哭,哭声直上干云霄!\n道旁过者问行人,行人但云点行频。\n或从十五北防河,便至四十西营田。\n去时里正与裹头,归来头白还戍边!\n边亭流血成海水,武皇开边意未已。\n君不闻,汉家山东二百州,千村万落生荆杞!\n纵有健妇把锄犁,禾生陇亩无东西。\n况复秦兵耐苦战,被驱不异犬与鸡。\n长者虽有问,役夫敢申恨?\n且如今年冬,未休关西卒。\n县官急索租,租税从何出?\n信知生男恶,反是生女好。\n生女犹得嫁比邻,生男埋没随百草!\n君不见,青海头,古来白骨无人收。\n新鬼烦冤旧鬼哭,天阴雨湿声啾啾!", - "type": "七言乐府", - "author": "杜甫", - "title": "兵车行" - }, - { - "id": 87, - "contents": "三月三日天气新,长安水边多丽人。\n态浓意远淑且真,肌理细腻骨肉匀。\n绣罗衣裳照暮春,蹙金孔雀银麒麟。\n头上何所有?翠微盍叶垂鬓唇。\n背后何所见?珠压腰[衤及]稳称身。\n就中云幕椒房亲,赐名大国虢与秦。\n紫驼之峰出翠釜,水精之盘行素鳞。\n犀箸餍饫久未下,鸾刀缕切空纷纶。\n黄门飞[革空]不动尘,御厨络绎送八珍。\n箫鼓哀吟感鬼神,宾从杂沓实要津。\n后来鞍马何逡巡,当轩下马入锦茵。\n杨花雪落覆白苹,青鸟飞去衔红巾。\n炙手可热势绝伦,慎莫近前丞相嗔!", - "type": "七言乐府", - "author": "杜甫", - "title": "丽人行" - }, - { - "id": 88, - "contents": "少陵野老吞生哭,春日潜行曲江曲。\n江头宫殿锁千门,细柳新蒲为谁绿?\n忆昔霓旌下南苑,苑中景物生颜色。\n昭阳殿里第一人,同辇随君侍君侧。\n辇前才人带弓箭,白马嚼啮黄金勒。\n翻身向天仰射云,一箭正坠双飞翼。\n明眸皓齿今何在?血污游魂归不得!\n清渭东流剑阁深,去住彼此无消息。\n人生有情泪沾臆,江水江花岂终极?\n黄昏胡骑尘满城,欲往城南望城北。", - "type": "七言乐府", - "author": "杜甫", - "title": "哀江头" - }, - { - "id": 89, - "contents": "长安城头头白乌,夜飞延秋门上呼。\n又向人家啄大屋,屋底达官走避胡。\n金鞭断折九马死,骨肉不待同驰驱。\n腰下宝[“决”换王旁]青珊瑚,可怜王孙泣路隅!\n问之不肯道姓名,但道困苦乞为奴。\n已经百日窜荆棘,身上无有完肌肤。\n高帝子孙尽隆准,龙种自与常人殊。\n豺狼在邑龙在野,王孙善保千金躯。\n不敢长语临交衢,且为王孙立斯须。\n昨夜东风吹血腥,东来橐驼满旧都。\n朔方健儿好身手,昔何勇锐今何愚!\n窃闻天子已传位,圣德北服南单于。\n花门□(“嫠”下女换刀)面请雪耻,慎勿出口他人狙!\n哀哉王孙慎勿疏,五陵佳气无时无。", - "type": "五言律诗", - "author": "杜甫", - "title": "哀王孙" - }, - { - "id": 90, - "contents": "夫子何为者,栖栖一代中。\n地犹鄹氏邑,宅即鲁王宫。\n叹凤嗟身否?伤麟怨道穷。\n今看两楹奠,当与梦时同。", - "type": "五言律诗", - "author": "唐玄宗", - "title": "经邹鲁祭孔子而叹之" - }, - { - "id": 91, - "contents": "海上生明月,天涯共此时。\n情人怨遥夜,竟夕起相思!\n灭烛怜光满,披衣觉露滋。\n不堪盈手赠,还寝梦佳期。", - "type": "五言律诗", - "author": "张九龄", - "title": "望月怀远" - }, - { - "id": 92, - "contents": "城阙辅三秦,风烟望五津。\n与君离别意,同是宦游人。\n海内存知己,天涯若比邻。\n无为在歧路,儿女共沾巾。", - "type": "五言律诗", - "author": "王勃", - "title": "送杜少府之任蜀州" - }, - { - "id": 93, - "contents": "余禁所禁垣西,是法厅事也。有古槐数株焉,虽生意可知,同殷仲文之古树,而听\n讼斯在,即周召伯之甘棠。每至夕照低阴,秋蝉疏引,发声幽息,有切尝闻;岂人\n心异於曩时,将虫响悲於前听?嗟乎!声以动容,德以象贤,故洁其身也,禀君子\n达人之高行;蜕其皮也,有仙都羽化之灵姿。候时而来,顺阴阳之数;应节为变,\n审藏用之机。有目斯开,不以道昏而昧其视;有翼自薄,不以俗厚而易其真。吟乔\n树之微风,韵资天纵;饮高秋之坠露,清畏人知。仆失路艰虞,遭时徽[纟墨],\n不哀伤而自怨,未摇落而先衰。闻蟪蛄之流声,悟平反之已奏;见螳螂之抱影,怯\n危机之未安。感而缀诗,贻诸知己。庶情沿物应,哀弱羽之飘零;道寄人知,悯馀\n声之寂寞。非谓文墨,取代幽忧云尔。\n西路蝉声唱,南冠客思侵。\n那堪玄鬓影,来对白头吟!\n露重飞难进,风多响易沉。\n无人信高洁,谁为表予心?", - "type": "五言律诗", - "author": "骆宾王", - "title": "在狱咏蝉并序" - }, - { - "id": 94, - "contents": "独有宦游人,偏惊物候新。\n云霞出海曙,梅柳渡江春。\n淑气催黄鸟,晴光转绿苹。\n忽闻歌古调,归思欲沾巾。", - "type": "五言律诗", - "author": "杜审言", - "title": "和晋陵路丞早春游望" - }, - { - "id": 95, - "contents": "闻道黄龙戍,频年不解兵。\n可怜闺里月,长在汉家营。\n少妇今春意,良人昨夜情。\n谁能将旗鼓,一为取龙城?", - "type": "五言律诗", - "author": "沈全期", - "title": "杂诗" - }, - { - "id": 96, - "contents": "阳月南飞雁,传闻至此回。\n我行殊未已,何日复归来?\n江静潮初落,林昏瘴不开。\n明朝望乡处,应见陇头梅。", - "type": "五言律诗", - "author": "宋之问", - "title": "题大庾岭北驿" - }, - { - "id": 97, - "contents": "客路青山外,行舟绿水前。\n潮平两岸阔,风正一帆悬。\n海日生残夜,江春入旧年。\n乡书何处达?归雁洛阳边。", - "type": "五言律诗", - "author": "王湾", - "title": "次北固山下" - }, - { - "id": 98, - "contents": "清晨入古寺,初日照高林。\n曲径通幽处,禅房花木深。\n山光悦鸟性,潭影空人心。\n万籁此俱寂,惟馀钟磬音。", - "type": "五言律诗", - "author": "常建", - "title": "题破山寺后禅院" - }, - { - "id": 99, - "contents": "联步趋丹陛,分曹限紫微。\n晓随天仗入,暮惹御香归。\n白发悲花落,青云羡鸟飞。\n圣朝无阙事,自觉谏书稀。", - "type": "五言律诗", - "author": "岑参", - "title": "寄左省杜拾遗" - }, - { - "id": 100, - "contents": "吾爱孟夫子,风流天下闻。\n红颜弃轩冕,白首卧松云。\n醉月频中圣,迷花不事君。\n高山安可仰,徒此挹清芬。", - "type": "五言律诗", - "author": "李白", - "title": "赠孟浩然" - }, - { - "id": 101, - "contents": "渡远荆门外,来从楚国游。\n山随平野尽,江入大荒流。\n月下飞天镜,云生结海楼。\n仍怜故乡水,万里送行舟。", - "type": "五言律诗", - "author": "李白", - "title": "渡荆门送别" - }, - { - "id": 102, - "contents": "青山横北郭,白水绕东城。\n此地一为别,孤蓬万里征。\n浮云游子意,落日故人情。\n挥手自兹去,萧萧班马鸣。", - "type": "五言律诗", - "author": "李白", - "title": "送友人" - }, - { - "id": 103, - "contents": "蜀僧抱绿绮,西下峨眉峰。\n为我一挥手,如听万壑松。\n客心洗流水,馀响入霜钟。\n不觉碧山暮,秋云暗几重。", - "type": "五言律诗", - "author": "李白", - "title": "听蜀僧浚弹琴" - }, - { - "id": 104, - "contents": "牛渚西江夜,青天无片云。\n登舟望秋月,空忆谢将军。\n余亦能高咏,斯人不可闻。\n明朝挂帆席,枫叶落纷纷。", - "type": "五言律诗", - "author": "李白", - "title": "夜泊牛渚怀古" - }, - { - "id": 105, - "contents": "今夜[鹿阝]州月,闺中只独看。\n遥怜小儿女,未解忆长安。\n香雾云鬟湿,清辉玉臂寒。\n何时倚虚幌,双照泪痕干?", - "type": "五言律诗", - "author": "杜甫", - "title": "月夜" - }, - { - "id": 106, - "contents": "国破山河在,城春草木深。\n感时花溅泪,恨别鸟惊心。\n烽火连三月,家书抵万金。\n白头搔更短,浑欲不胜簪。", - "type": "五言律诗", - "author": "杜甫", - "title": "春望" - }, - { - "id": 107, - "contents": "花隐掖垣暮,啾啾栖鸟过。\n星临万户动,月傍九霄多。\n不寝听金钥,因风想玉珂。\n明朝有封事,数问夜如何?", - "type": "五言律诗", - "author": "杜甫", - "title": "春宿左省" - }, - { - "id": 108, - "contents": "此道昔归顺,西郊胡正繁。\n至今残破胆,应有未招魂。\n近得归京邑,移官岂至尊?\n无才日衰老,驻马望千门。", - "type": "五言律诗", - "author": "杜甫", - "title": "至德二载甫自京金光门出,问道归凤翔。乾元初从左拾遗移华州掾。与亲故别,因出此门。有悲往事。" - }, - { - "id": 109, - "contents": "戍鼓断人行,秋边一雁声。\n露从今夜白,月是故乡明。\n有弟皆分散,无家问死生。\n寄书长不达,况乃未休兵。", - "type": "五言律诗", - "author": "杜甫", - "title": "月夜忆舍弟" - }, - { - "id": 110, - "contents": "凉风起天末,君子意如何?\n鸿雁几时到,江湖秋水多。\n文章憎命达,魑魅喜人过。\n应共冤魂语,投诗赠汨罗。", - "type": "五言律诗", - "author": "杜甫", - "title": "天末怀李白" - }, - { - "id": 111, - "contents": "远送从此别,青山空复情。\n几时杯重把,昨夜月同行。\n列郡讴歌惜,三朝出入荣。\n将村独归处,寂寞养残生。", - "type": "五言律诗", - "author": "杜甫", - "title": "奉济驿重送严公四韵" - }, - { - "id": 112, - "contents": "他乡复行役,驻马别孤坟。\n近泪无干土,低空有断云。\n对棋陪谢傅,把剑觅徐君。\n唯见林花落,莺啼送客闻。", - "type": "五言律诗", - "author": "杜甫", - "title": "别房太尉墓" - }, - { - "id": 113, - "contents": "细草微风岸,危樯独夜舟。\n星垂平野阔,月涌大江流。\n名岂文章著?官应老病休。\n飘飘何所似,天地一沙鸥。", - "type": "五言律诗", - "author": "杜甫", - "title": "旅夜书怀" - }, - { - "id": 114, - "contents": "昔闻洞庭水,今上岳阳楼。\n吴楚东南坼,乾坤日夜浮。\n亲朋无一字,老病有孤舟。\n戎马关山北,凭轩涕泗流。", - "type": "五言律诗", - "author": "杜甫", - "title": "登岳阳楼" - }, - { - "id": 115, - "contents": "寒山转苍翠,秋水日潺[氵爰]。\n倚杖柴门外,临风听暮蝉。\n渡头馀落日,墟里上孤烟。\n复值接舆醉,狂歌五柳前。", - "type": "五言律诗", - "author": "王维", - "title": "辋川闲居赠裴秀才迪" - }, - { - "id": 116, - "contents": "空山新雨后,天气晚来秋。\n明月松间照,清泉石上流。\n竹喧归浣女,莲动下渔舟。\n随意春芳歇,王孙自可留。", - "type": "五言律诗", - "author": "王维", - "title": "山居秋暝" - }, - { - "id": 117, - "contents": "清川带长薄,车马去闲闲。\n流水如有意,暮禽相与还。\n荒城临古渡,落日满秋山。\n迢递嵩高下,归来且闭关。", - "type": "五言律诗", - "author": "王维", - "title": "归嵩山作" - }, - { - "id": 118, - "contents": "太乙近天都,连山接海隅。\n白云回望合,青霭入看无。\n分野中峰变,阴晴众壑殊。\n欲投人处宿,隔水问樵夫。", - "type": "五言律诗", - "author": "王维", - "title": "终南山" - }, - { - "id": 119, - "contents": "晚年惟好静,万事不关心。\n自顾无长策,空知返旧林。\n松风吹解带,山月照弹琴。\n君问穷通理,渔歌入浦深。", - "type": "五言律诗", - "author": "王维", - "title": "酬张少府" - }, - { - "id": 120, - "contents": "不知香积寺,数里入云峰。\n古木无人径,深山何处钟?\n泉声咽危石,日色冷青松。\n薄暮空潭曲,安禅制毒龙。", - "type": "五言律诗", - "author": "王维", - "title": "过香积寺" - }, - { - "id": 121, - "contents": "万壑树参天,千山响杜鹃。\n山中一夜雨,树杪百重泉。\n汉女输[木童]布,巴人讼芋田。\n文翁翻教授,不敢倚先贤。", - "type": "五言律诗", - "author": "王维", - "title": "送梓州李使君" - }, - { - "id": 122, - "contents": "楚塞三湘接,荆门九派通。\n江流天地外,山色有无中。\n郡邑浮前浦,波澜动远空。\n襄阳好风日,留醉与山翁。", - "type": "五言律诗", - "author": "王维", - "title": "汉江临眺" - }, - { - "id": 123, - "contents": "中岁颇好道,晚家南山陲。\n兴来美独往,胜事空自知。\n行到水穷处,坐看云起时。\n偶然值林叟,谈笑无还期。", - "type": "五言律诗", - "author": "王维", - "title": "终南别业" - }, - { - "id": 124, - "contents": "八月湖水平,涵虚混太清。\n气蒸云梦泽,波撼岳阳城。\n欲济无舟楫,端居耻圣明。\n坐观垂钓者,空有羡鱼情。", - "type": "五言律诗", - "author": "孟浩然", - "title": "望洞庭湖赠张丞相" - }, - { - "id": 125, - "contents": "人事有代谢,往来成古今。\n江山留胜迹,我辈复登临。\n水落鱼梁浅,天寒梦泽深。\n羊公碑字在,读罢泪沾襟。", - "type": "五言律诗", - "author": "孟浩然", - "title": "与诸子登岘山" - }, - { - "id": 126, - "contents": "林卧愁春尽,开轩览物华。\n忽逢青鸟使,邀入赤松家。\n丹灶初开火,仙桃正发花。\n童颜若可驻,何惜醉流霞!", - "type": "五言律诗", - "author": "孟浩然", - "title": "清明日宴梅道士房" - }, - { - "id": 127, - "contents": "北阙休上书,南山归敝庐。\n不才明主弃,多病故人疏。\n白发催年老,青阳逼岁除。\n永怀愁不寐,松月夜窗墟。", - "type": "五言律诗", - "author": "孟浩然", - "title": "岁暮归南山" - }, - { - "id": 128, - "contents": "故人具鸡黍,邀我至田家。\n绿树村边合,青山郭外斜。\n开轩面场圃,把酒话桑麻。\n待到重阳日,还来就菊花。", - "type": "五言律诗", - "author": "孟浩然", - "title": "过故人庄" - }, - { - "id": 129, - "contents": "一丘尝欲卧,三径苦无资。\n北土非吾愿,东林怀我师。\n黄金燃桂尽,壮志逐年衰。\n日夕凉风至,闻蝉但益悲。", - "type": "五言律诗", - "author": "孟浩然", - "title": "秦中感秋寄远上人" - }, - { - "id": 130, - "contents": "山暝听猿愁,沧江急夜流。\n风鸣两岸叶,月照一孤舟。\n建德非吾土,维扬忆旧游。\n还将两行泪,遥寄海西头。", - "type": "五言律诗", - "author": "孟浩然", - "title": "宿桐庐江寄广陵旧游" - }, - { - "id": 131, - "contents": "寂寂竟何待,朝朝空自归。\n欲寻芳草去,惜与故人违。\n当路谁相假,知音世所稀。\n只应守寂寞,还掩故园扉。", - "type": "五言律诗", - "author": "孟浩然", - "title": "留别王侍御维" - }, - { - "id": 132, - "contents": "木落雁南渡,北风江上寒。\n我家襄水曲,遥隔楚云端。\n乡泪客中尽,孤帆天际看。\n迷津欲有问,平海夕漫漫。", - "type": "五言律诗", - "author": "孟浩然", - "title": "早寒江上有怀" - }, - { - "id": 133, - "contents": "古台摇落后,秋日望乡心。\n野寺人来少,云峰水隔深。\n夕阳依旧垒,寒磬满空林。\n惆怅南朝事,长江独至今。", - "type": "五言律诗", - "author": "刘长卿", - "title": "秋日登吴公台上寺远眺" - }, - { - "id": 134, - "contents": "流落征南将,曾驱十万师。\n罢归无旧业,老去恋明时。\n独立三边静,轻生一剑知。\n茫茫江汉上,日暮复何之。", - "type": "五言律诗", - "author": "刘常卿", - "title": "送李中丞归汉阳别业" - }, - { - "id": 135, - "contents": "望君烟水阔,挥手泪沾巾。\n飞鸟没何处,青山空向人。\n长江一帆远,落日五湖春。\n谁见汀洲上,相思愁白苹?", - "type": "五言律诗", - "author": "刘长卿", - "title": "饯别王十一南游" - }, - { - "id": 136, - "contents": "一路经行处,莓苔见履痕。\n白云依静渚,春草闭闲门。\n过雨看松色,随山到水源。\n溪花与禅意,相对亦忘言。", - "type": "五言律诗", - "author": "刘长卿", - "title": "寻南溪常山道人隐居" - }, - { - "id": 137, - "contents": "乡心新岁切,天畔独潸然。\n老至居人下,春归在客先。\n岭猿同旦暮,江柳共风烟。\n已似长沙傅,从今又几年?", - "type": "五言律诗", - "author": "刘长卿", - "title": "新年作" - }, - { - "id": 138, - "contents": "上国随缘住,来途若梦行。\n浮天沧海远,去世法舟轻。\n水月通禅寂,鱼龙听梵声。\n惟怜一灯影,万里眼中明。", - "type": "五言律诗", - "author": "钱起", - "title": "送僧归日本" - }, - { - "id": 139, - "contents": "泉壑带茅茨,云霞生薜帷。\n竹怜新雨后,山爱夕阳时。\n闲鹭栖常早,秋花落更迟。\n家童扫萝径,昨与故人期。", - "type": "五言律诗", - "author": "钱起", - "title": "谷口书斋寄杨补阙" - }, - { - "id": 140, - "contents": "江汉曾为客,相逢每醉还。\n浮云一别后,流水十年间。\n欢笑情如旧,萧疏鬓已斑。\n何因北归去,淮上对秋山。", - "type": "五言律诗", - "author": "韦应物", - "title": "淮上喜会梁川故人" - }, - { - "id": 141, - "contents": "楚江微雨里,建业暮钟时。\n漠漠帆来重,冥冥鸟去迟。\n海门深不见,浦树远含滋。\n相送情无限,沾襟比散丝。", - "type": "五言律诗", - "author": "韦应物", - "title": "赋得暮雨送李胄" - }, - { - "id": 142, - "contents": "长簟迎风早,空城澹月华。\n星河秋一雁,砧杵夜千家。\n节候看应晚,心期卧亦赊。\n向来吟秀句,不觉已鸣鸦。", - "type": "五言律诗", - "author": "韩□(“雄”右半换“羽”)", - "title": "酬程延秋夜即事见赠" - }, - { - "id": 143, - "contents": "道由白云尽,春与青溪长。\n时有落花至,远隋流水香。\n闲门向山路,深柳读书堂。\n幽映每白日,清辉照衣裳。", - "type": "五言律诗", - "author": "刘脊虚", - "title": "阙题" - }, - { - "id": 144, - "contents": "天秋月又满,城阙夜千重。\n还作江南会,翻疑梦里逢。\n风枝惊暗鹊,露草覆寒虫。\n羁旅长堪醉,相留畏晓钟。", - "type": "五言律诗", - "author": "戴叔伦", - "title": "江乡故人偶集客舍" - }, - { - "id": 145, - "contents": "故关衰草遍,离别正堪悲!\n路出寒云外,人归暮雪时。\n少孤为客早,多难识君迟。\n掩泪空相向,风尘何处期?", - "type": "五言律诗", - "author": "卢纶", - "title": "李端公" - }, - { - "id": 146, - "contents": "十年离乱后,长大一相逢。\n问姓惊初见,称名忆旧容。\n别来沧海事,语罢暮天钟。\n明日巴陵道,秋山又几重。", - "type": "五言律诗", - "author": "李益", - "title": "喜见外弟又言别" - }, - { - "id": 147, - "contents": "故人江海别,几度隔山川。\n乍见翻疑梦,相悲各问年。\n孤灯寒照雨,深竹暗浮烟。\n更有明朝恨,离杯惜共传。", - "type": "五言律诗", - "author": "司空曙", - "title": "云阳馆与韩绅宿别" - }, - { - "id": 148, - "contents": "静夜四无邻,荒居旧业贫。\n雨中黄叶树,灯下白头人。\n以我独沉久,愧君相访频。\n平生自有分,况是蔡家亲!", - "type": "五言律诗", - "author": "司空曙", - "title": "喜外弟卢纶见宿" - }, - { - "id": 149, - "contents": "世乱同南去,时清独北还。\n他乡生白发,旧国见青山。\n晓月过残垒,繁星宿故关。\n寒禽与衰草,处处伴愁颜。", - "type": "五言律诗", - "author": "司空曙", - "title": "贼平后送人北归" - }, - { - "id": 150, - "contents": "天地英雄气,千秋尚凛然!\n势分三足鼎,业复五铢钱。\n得相能开国,生儿不象贤。\n凄凉蜀故妓,来舞魏宫前。", - "type": "五言律诗", - "author": "刘禹锡", - "title": "蜀先主庙" - }, - { - "id": 151, - "contents": "前年伐月支,城下没全师。\n蕃汉断消息,死生长别离。\n无人收废帐,归马识残旗。\n欲祭疑君在,天涯哭此时。", - "type": "五言律诗", - "author": "张籍", - "title": "没蕃故人" - }, - { - "id": 152, - "contents": "离离原上草,一岁一枯荣。\n野火烧不尽,春风吹又生。\n远芳侵古道,晴翠接荒城。\n又送王孙去,萋萋满别情。", - "type": "五言律诗", - "author": "白居易", - "title": "赋得古原草送别" - }, - { - "id": 153, - "contents": "旅馆无良伴,凝情自悄然。\n寒灯思旧事,断雁警愁眠。\n远梦归侵晓,家书到隔年。\n沧江好烟月,门系钓鱼船。", - "type": "五言律诗", - "author": "杜牧", - "title": "旅宿" - }, - { - "id": 154, - "contents": "红叶晚萧萧,长亭酒一瓢。\n残云归太华,疏雨过中条。\n树色随山迥,河声入海遥。\n帝乡明日到,犹自梦渔樵。", - "type": "五言律诗", - "author": "许浑", - "title": "秋日赴阙题潼关驿楼" - }, - { - "id": 155, - "contents": "遥夜泛清瑟,西风生翠萝。\n残萤栖玉露,早雁拂银河。\n高树晓还密,远山晴更多。\n淮南一叶下,自觉老烟波。", - "type": "五言律诗", - "author": "许浑", - "title": "早秋" - }, - { - "id": 156, - "contents": "本以高难饱,徒劳恨费声。\n五更疏欲断,一树碧无情。\n薄宦梗犹泛,故园芜已平。\n烦君最相警,我亦举家清。", - "type": "五言律诗", - "author": "李商隐", - "title": "蝉" - }, - { - "id": 157, - "contents": "凄凉宝剑篇,羁泊欲穷年。\n黄叶仍风雨,青楼自管弦。\n新知遭薄俗,旧好隔良缘。\n心断新丰酒,销愁斗几千。", - "type": "五言律诗", - "author": "李商隐", - "title": "风雨" - }, - { - "id": 158, - "contents": "高阁客竟去,小园花乱飞。\n参差连曲陌,迢递送斜晖。\n肠断未忍扫,眼穿仍欲归。\n芳心向春尽,所得是沾衣。", - "type": "五言律诗", - "author": "李商隐", - "title": "落花" - }, - { - "id": 159, - "contents": "客去波平槛,蝉休露满枝。\n永怀当此节,倚立自移时。\n北斗兼春远,南陵寓使迟。\n天涯占梦数,疑误有新知。", - "type": "五言律诗", - "author": "李商隐", - "title": "凉思" - }, - { - "id": 160, - "contents": "残阳西入崦,茅屋访孤僧。\n落叶人何在?寒云路几层?\n独敲初夜磬,闲倚一枝藤。\n世界微尘里,吾宁爱与憎。", - "type": "五言律诗", - "author": "李商隐", - "title": "北青萝" - }, - { - "id": 161, - "contents": "荒戍落黄叶,浩然离故关。\n高风汉阳渡,初日郢门山。\n江上几人在?天涯孤棹还。\n何当重相见,樽酒慰离颜?", - "type": "五言律诗", - "author": "温庭筠", - "title": "送人东游" - }, - { - "id": 162, - "contents": "灞原风雨定,晚见雁行频。\n落叶他乡树,寒灯独夜人。\n空园白露滴,孤壁野僧邻。\n寄卧郊扉久,何年致此身?", - "type": "五言律诗", - "author": "马戴", - "title": "灞上秋居" - }, - { - "id": 163, - "contents": "露气寒光集,微阳下楚丘。\n猿啼洞庭树,人在木兰舟。\n广泽生明月,苍山夹乱流。\n云中君不见,竟夕自悲秋。", - "type": "五言律诗", - "author": "马戴", - "title": "楚江怀古" - }, - { - "id": 164, - "contents": "调角断清秋,征人倚戍楼。\n春风对青冢,白日落梁州。\n大漠无兵阻,穷边有客游。\n蕃情似此水,长愿向南流。", - "type": "五言律诗", - "author": "张乔", - "title": "书边事" - }, - { - "id": 165, - "contents": "迢递三巴路,羁危万里身。\n乱山残雪夜,孤独异乡春。\n渐与骨肉远,转於僮仆亲。\n那堪正飘泊,明日岁华新。", - "type": "五言律诗", - "author": "崔涂", - "title": "巴山道中除夜有怀" - }, - { - "id": 166, - "contents": "几行归塞尽,片影独何之?\n暮雨相呼失,寒塘欲下迟。\n渚云低暗渡,关月冷相随。\n未必逢[矢曾]缴,孤飞自可疑。", - "type": "五言律诗", - "author": "崔涂", - "title": "孤雁" - }, - { - "id": 167, - "contents": "早被婵娟误,欲妆临镜慵。\n承恩不在貌,教妾若为容。\n风暖鸟声碎,日高花影重。\n年年越溪女,相忆采芙蓉。", - "type": "五言律诗", - "author": "杜荀鹤", - "title": "春宫怨" - }, - { - "id": 168, - "contents": "清瑟怨遥夜,绕弦风雨哀。\n孤灯闻楚角,残月下章台。\n芳草已云暮,故人殊未来。\n乡书不可寄,秋雁又南回。", - "type": "五言律诗", - "author": "韦庄", - "title": "章台夜思" - }, - { - "id": 169, - "contents": "移家虽带郭,野径入桑麻。\n近种篱边菊,秋来未著花。\n扣门无犬吠,欲去问西家。\n报到山中去,归来每日斜。", - "type": "五言律诗", - "author": "僧皎然", - "title": "寻陆鸿渐不遇" - }, - { - "id": 170, - "contents": "昔人已乘黄鹤去,此地空馀黄鹤楼。\n黄鹤一去不复返,白云千载空悠悠。\n晴川历历汉阳树,芳草萋萋鹦鹉洲。\n日暮乡关何处是,烟波江上使人愁。", - "type": "七言律诗", - "author": "崔颢", - "title": "黄鹤楼" - }, - { - "id": 171, - "contents": "迢□(“绕”换山旁)太华俯咸京,天外三峰削不成。\n武帝祠前云欲散,仙人掌上雨初晴。\n河山北枕秦关险,驿树西连汉[田寺]平。\n借问路傍名利客,无如此处学长生。", - "type": "七言律诗", - "author": "崔颢", - "title": "行经华阴" - }, - { - "id": 172, - "contents": "燕台一去客心惊,箫鼓喧喧汉将营。\n万里寒光生积雪,三边曙色动危旌。\n沙场烽火侵胡月,海畔云山拥蓟城。\n少小虽非投笔吏,论功还欲请长缨。", - "type": "七言律诗", - "author": "祖咏", - "title": "望蓟门" - }, - { - "id": 173, - "contents": "朝闻游子唱骊歌,昨夜微霜初度河。\n鸿雁不堪愁里听,云山况是客中过。\n关城树色催寒近,御苑砧声向晚多。\n莫见长安行乐处,空令岁月易蹉跎。", - "type": "七言律诗", - "author": "李颀", - "title": "送魏万之京" - }, - { - "id": 174, - "contents": "汉文皇帝有高台,此日登临曙色开。\n三晋云山皆北向,二陵风雨自东来。\n关门令尹谁能识?河上仙翁去不回。\n且欲竟寻彭泽宰,陶然共醉菊花杯。", - "type": "七言律诗", - "author": "崔曙", - "title": "九日登望仙台呈刘明府" - }, - { - "id": 176, - "contents": "嗟君此别意何如?驻马衔杯问谪居。\n巫峡啼猿数行泪,衡阳归雁几封书。\n青枫江上秋帆远,白帝城边古木疏。\n圣代即今多雨露,暂时分手莫踌躇。", - "type": "七言律诗", - "author": "高适", - "title": "送李少府贬峡中王少府贬长沙" - }, - { - "id": 177, - "contents": "鸡鸣紫陌曙光寒,莺啭皇州春色阑。\n金阙晓钟开万户,玉阶仙仗拥千官。\n花迎剑佩星初落,柳拂旌旗露未干。\n独有凤凰池上客,阳春一曲和皆难。", - "type": "七言律诗", - "author": "岑参", - "title": "奉和中书舍人贾至早朝大明宫" - }, - { - "id": 178, - "contents": "绛帻鸡人送晓筹,尚衣方进翠云裘。\n九天阊阖开宫殿,万国衣冠拜冕旒。\n日色才临仙掌动,香烟欲傍衮龙浮。\n朝罢须裁五色诏,佩声归向凤池头。", - "type": "七言律诗", - "author": "王维", - "title": "和贾舍人早朝大明宫之作" - }, - { - "id": 179, - "contents": "渭水自萦秦塞曲,黄山旧绕汉宫斜。\n銮舆迥出千门柳,阁道回看上苑花。\n云里帝城双凤阙,雨中春树万人家。\n为乘阳气行时令,不是宸游玩物华。", - "type": "七言律诗", - "author": "王维", - "title": "奉和圣制从蓬莱向兴庆阁道中留春雨中春望之作应制" - }, - { - "id": 180, - "contents": "积雨空林烟火迟,蒸藜炊黍饷东□(“淄”去三点水加草头)。\n漠漠水田飞白鹭,阴阴夏木啭黄鹂。\n山中习静观朝槿,松下清斋折露葵。\n野老与人争席罢,海鸥何事更相疑。", - "type": "七言律诗", - "author": "王维", - "title": "积雨辋川庄作" - }, - { - "id": 181, - "contents": "洞门高阁霭馀辉,桃李阴阴柳絮飞。\n禁里疏钟官舍晚,省中啼鸟吏人稀。\n晨摇玉佩趋金殿,夕奉天书拜琐闱。\n强欲从君无那老,将因卧病解朝衣。", - "type": "七言律诗", - "author": "王维", - "title": "酬郭给事" - }, - { - "id": 182, - "contents": "丞相祠堂何处寻?锦官城外柏森森。\n映阶碧草自春色,隔叶黄鹂空好音。\n三顾频烦天下计,两朝开济老臣心。\n出师未捷身先死,长使英雄泪满襟!", - "type": "七言律诗", - "author": "杜甫", - "title": "蜀相" - }, - { - "id": 183, - "contents": "舍南舍北皆春水,但见群鸥日日来。\n花径不曾缘客扫,蓬门今始为君开。\n盘飧市远无兼味,樽酒家贫只旧醅。\n肯与邻翁相对饮,隔篱呼取尽馀杯!", - "type": "七言律诗", - "author": "杜甫", - "title": "客至" - }, - { - "id": 184, - "contents": "西山白雪三城戍,南浦清江万里桥。\n海内风尘诸弟隔,天涯涕泪一身遥。\n唯将迟暮供多病,未有涓埃答圣朝。\n跨马出郊时极目,不堪人事日萧条!", - "type": "七言律诗", - "author": "杜甫", - "title": "野望" - }, - { - "id": 185, - "contents": "剑外忽传收蓟北,初闻涕泪满衣裳。\n却看妻子愁何在,漫卷诗书喜欲狂。\n白日放歌须纵酒,青春作伴好还乡!\n即从巴峡穿巫峡,便下襄阳向洛阳。", - "type": "七言律诗", - "author": "杜甫", - "title": "闻官军收河南河北" - }, - { - "id": 186, - "contents": "风急天高猿啸哀,渚清沙白鸟飞回。\n无边落木萧萧下,不尽长江滚滚来。\n万里悲秋常作客,百年多病独登台。\n艰难苦恨繁霜鬓,潦倒新停浊酒杯。", - "type": "七言律诗", - "author": "杜甫", - "title": "登高" - }, - { - "id": 187, - "contents": "花近高楼伤客心,万方多难此登临。\n锦江春色来天地,玉垒浮云变古今。\n北极朝庭终不改,西山寇盗莫相侵!\n可怜后主还祠庙,日暮聊为梁父吟。", - "type": "七言律诗", - "author": "杜甫", - "title": "登楼" - }, - { - "id": 188, - "contents": "清秋幕府井梧寒,独宿江城蜡炬残。\n永夜角声悲自语,中天月色好谁看?\n风尘荏苒音书绝,关塞萧条行陆难。\n已忍伶俜十年事,强移栖息一枝安。", - "type": "七言律诗", - "author": "杜甫", - "title": "宿府" - }, - { - "id": 189, - "contents": "岁暮阴阳催短景,天涯霜雪霁寒霄。\n五更鼓角声悲壮,三峡星河影动摇。\n野哭千家闻战伐,夷歌数处起渔樵。\n卧龙跃马终黄土,人事音书漫寂寥。", - "type": "七言律诗", - "author": "杜甫", - "title": "阁夜" - }, - { - "id": 190, - "contents": "支离东北风尘际,漂泊西南天地间。\n三峡楼台淹日月,五溪衣服共云山。\n羯胡事主终无赖,词客哀时且未还。\n庾信平生最萧瑟,暮年诗赋动江关。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之一" - }, - { - "id": 191, - "contents": "摇落深知宋玉悲,风流儒雅亦吾师。\n怅望千秋一洒泪,萧条异代不同时。\n江山故宅空文藻,云雨荒台岂梦思!\n最是楚宫俱泯灭,舟人指点到今疑。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之二" - }, - { - "id": 192, - "contents": "群山万壑赴荆门,生长明妃尚有村。\n一去紫台连朔漠,独留青冢向黄昏。\n画图省识春风面,环佩空归月下魂。\n千载琵琶作胡语,分明怨恨曲中论。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之三" - }, - { - "id": 193, - "contents": "蜀主征吴幸三峡,崩年亦在永安宫。\n翠华想像空山里,玉殿虚无野寺中。\n古庙杉松巢水鹤,岁时伏腊走村翁。\n武侯祠屋常邻近,一体君臣祭祀同。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之四" - }, - { - "id": 194, - "contents": "诸葛大名垂宇宙,宗臣遗像肃清高。\n三分割据纡筹策,万古云霄一羽毛。\n伯仲之间见伊吕,指挥若定失萧曹。\n运移汉祚终难复,志决身歼军务劳。", - "type": "七言律诗", - "author": "杜甫", - "title": "咏怀古迹五首之五" - }, - { - "id": 195, - "contents": "生涯岂料承优诏?世事空知学醉歌。\n江上月明胡雁过,淮南木落楚山多。\n寄身且喜沧洲近,顾影无如白发何!\n今日龙钟人共老,愧君犹遣慎风波。", - "type": "七言律诗", - "author": "刘长卿", - "title": "江州重别薛六柳八二员外" - }, - { - "id": 196, - "contents": "三年谪宦此栖迟,万古惟留楚客悲。\n秋草独寻人去后,寒林空见日斜时。\n汉文有道恩犹薄,湘水无情吊岂知?\n寂寂江山摇落处,怜君何事到天涯!", - "type": "七言律诗", - "author": "刘长卿", - "title": "长沙过贾谊宅" - }, - { - "id": 197, - "contents": "汀洲无浪复无烟,楚客相思益渺然。\n汉口夕阳斜渡鸟,洞庭秋水远连天。\n孤城背岭寒吹角,独戍临江夜泊船。\n贾谊上书忧汉室,长沙谪去古今怜。", - "type": "七言律诗", - "author": "刘长卿", - "title": "自夏口至鹦洲夕望岳阳寄源中丞" - }, - { - "id": 198, - "contents": "二月黄鹂飞上林,春城紫禁晓阴阴。\n长乐钟声花外尽,龙池柳色雨中深。\n阳和不散穷途恨,霄汉长怀捧日心。\n献赋十年犹未遇,羞将白发对华簪。", - "type": "七言律诗", - "author": "钱起", - "title": "赠阙下裴舍人" - }, - { - "id": 199, - "contents": "去年花里逢君别,今日花开又一年。\n世事茫茫难自料,春愁黯黯独成眠。\n身多疾病思田里,邑有流亡愧俸钱。\n闻道欲来相问讯,西楼望月几回圆?", - "type": "七言律诗", - "author": "韦应物", - "title": "寄李儋元锡" - }, - { - "id": 200, - "contents": "仙台初见五城楼,风物凄凄宿雨收。\n山色遥连秦树晚,砧声近报汉宫秋。\n疏松影落空坛静,细草香闲小洞幽。\n何用别寻方外去,人间亦自有丹丘!", - "type": "七言律诗", - "author": "韩□", - "title": "同题仙游观" - }, - { - "id": 201, - "contents": "莺啼燕语报新年,马邑龙堆路几千。\n家住层城邻汉苑,心随明月到胡天。\n机中锦字论长恨,楼上花枝笑独眠。\n为问天戎窦车骑,何时返旆勒燕然?", - "type": "七言律诗", - "author": "皇甫冉", - "title": "春思" - }, - { - "id": 202, - "contents": "云开远见汉阳城,犹是孤帆一日程。\n估客昼眠知浪静,舟人夜语觉潮生。\n三湘愁鬓逢秋色,万里归心对月明。\n旧业已随征战尽,更堪江上鼓鼙声。", - "type": "七言律诗", - "author": "卢纶", - "title": "晚次鄂州" - }, - { - "id": 203, - "contents": "城上高楼接大荒,海天愁思正茫茫。\n惊风乱[风占)芙蓉水,密雨斜侵薜荔墙。\n岭树重遮千里目,江流曲似九回肠。\n共来百越文身地,犹自音书滞一乡。", - "type": "七言律诗", - "author": "柳宗元", - "title": "登柳州城楼寄漳汀封连四州刺史" - }, - { - "id": 204, - "contents": "王浚楼船下益州,金陵王气黯然收。\n千寻铁锁沈江底,一片降幡出石头。\n人世几回伤往事?山形依旧枕寒流。\n从今四海为家日,故垒萧萧芦荻秋。", - "type": "七言律诗", - "author": "刘禹锡", - "title": "西塞山怀古" - }, - { - "id": 205, - "contents": "谢公最小偏怜女,自嫁黔娄百事乖。\n顾我无衣搜荩箧,泥他沽酒拔金钗。\n野蔬充膳甘长藿,落叶添薪仰古槐。\n今日俸钱过十万,与君营奠复营斋。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之一" - }, - { - "id": 206, - "contents": "昔日戏言身后事,今朝都到眼前来。\n衣裳已施行看尽,针线犹存未忍开。\n尚想旧情怜婢仆,也曾因梦送钱财。\n诚知此恨人人有,贫贱夫妻百事哀。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之二" - }, - { - "id": 207, - "contents": "闲坐悲君亦自悲,百年都是几多时?\n邓攸无子寻知命,潘岳悼亡犹费词。\n同穴□(上“穴”下“目”)冥何所望,他生缘会更难期。\n惟将终夜长开眼,报答平生未展眉。", - "type": "七言律诗", - "author": "元稹", - "title": "遣悲怀三首之三" - }, - { - "id": 208, - "contents": "时难年荒世业空,弟兄羁旅各西东。\n田园寥落干戈后,骨肉流离道路中。\n吊影分为千里雁,辞根散作九秋蓬。\n共看明月应垂泪,一夜乡心五处同。", - "type": "七言律诗", - "author": "白居易", - "title": "望月有感" - }, - { - "id": 209, - "contents": "锦瑟无端五十弦,一弦一柱思华年。\n庄生晓梦迷蝴蝶,望帝春心托杜鹃。\n沧海月明珠有泪,蓝田日暖玉生烟。\n此情可待成追忆,只是当时已惘然。", - "type": "七言律诗", - "author": "李商隐", - "title": "锦瑟" - }, - { - "id": 210, - "contents": "昨夜星辰昨夜风,画楼西畔桂堂东。\n身无彩凤双飞翼,心有灵犀一点通。\n隔座送钩春酒暖,分曹射覆蜡灯红。\n嗟余听鼓应官去,走马兰台类转蓬。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题" - }, - { - "id": 211, - "contents": "紫泉宫殿锁烟霞,欲取芜城作帝家。\n玉玺不缘归日角,锦帆应是到天涯。\n於今腐草无萤火,终古垂杨有暮鸦。\n地下若逢陈后主,岂宜重问后庭花?", - "type": "七言律诗", - "author": "李商隐", - "title": "隋宫" - }, - { - "id": 212, - "contents": "来是空言去绝踪,月斜楼上五更钟。\n梦为远别啼难唤,书被催成墨未浓。\n蜡照半笼金翡翠,麝熏微度绣芙蓉。\n刘郎已恨蓬山远,更隔蓬山一万重。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之一" - }, - { - "id": 213, - "contents": "飒飒东风细雨来,芙蓉塘外有轻雷。\n金蟾啮锁烧香入,玉虎牵丝汲井回。\n贾氏窥帘韩掾少,宓妃留枕魏王才。\n春心莫共花争发,一寸相思一寸灰。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之二" - }, - { - "id": 214, - "contents": "猿鸟犹疑畏简书,风云常为护储胥。\n徒令上将挥神笔,终见降王走传车。\n管乐有才原不忝,关张无命欲何如。\n他年锦里经祠庙,梁父吟成恨有馀。", - "type": "七言律诗", - "author": "李商隐", - "title": "筹笔驿" - }, - { - "id": 215, - "contents": "相见时难别亦难,东风无力百花残。\n春蚕到死丝方尽,蜡炬成灰泪始干。\n晓镜但愁云鬓改,夜吟应觉月光寒。\n蓬莱此去无多路,青鸟殷勤为探看。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题" - }, - { - "id": 216, - "contents": "怅卧新春白袷衣,白门寥落意多违。\n红楼隔雨相望冷,珠箔飘灯独自归。\n远路应悲春[日宛]晚,残宵犹得梦依稀。\n玉[王当]缄札何由达?万里云罗一雁飞。", - "type": "七言律诗", - "author": "李商隐", - "title": "春雨" - }, - { - "id": 217, - "contents": "凤尾香罗薄几重,碧文圆顶夜深缝。\n扇裁月魄羞难掩,车走雷声语未通。\n曾是寂寥金烬暗,断无消息石榴红。\n斑骓只系垂杨岸,何处西南任好风?", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之一" - }, - { - "id": 218, - "contents": "重帷深下莫愁堂,卧后清宵细细长。\n神女生涯原是梦,小姑居处本无郎。\n风波不信菱枝弱,月露谁教桂叶香?\n直道相思了无益,未妨惆怅是清狂。", - "type": "七言律诗", - "author": "李商隐", - "title": "无题二首之二" - }, - { - "id": 219, - "contents": "澹然空水对斜晖,曲岛苍茫接翠微。\n波上马嘶看棹去,柳边人歇待船归。\n数丛沙草群鸥散,万顷江田一鹭飞。\n谁解乘舟寻范蠡,五湖烟水独忘机?", - "type": "七言律诗", - "author": "温庭筠", - "title": "利洲南渡" - }, - { - "id": 220, - "contents": "苏武魂销汉使前,古祠高树两茫然。\n云边雁断胡天月,陇上羊归塞草烟。\n回日楼台非甲帐,去时冠剑是丁年。\n茂陵不见封侯印,空向秋波哭逝川。", - "type": "七言律诗", - "author": "温庭筠", - "title": "苏武庙" - }, - { - "id": 221, - "contents": "十二楼中尽晓妆,望仙楼上望君王。\n锁衔金兽连环冷,水滴铜龙昼漏长。\n云髻罢梳还对镜,罗衣欲换更添香。\n遥窥正殿帘开处,袍裤宫人扫御床。", - "type": "七言律诗", - "author": "薛逢", - "title": "宫词" - }, - { - "id": 222, - "contents": "蓬门未识绮罗香,拟托良媒益自伤。\n谁爱风流高格调?共怜时世俭梳妆。\n敢将十指夸针巧,不把双眉斗画长。\n苦恨年年压金线,为他人作嫁衣裳。", - "type": "七言律诗", - "author": "秦韬玉", - "title": "贫女" - }, - { - "id": 223, - "contents": "卢家少妇郁金香,海燕双栖玳瑁梁。\n九月寒砧催木叶,十年征戍忆辽阳。\n白狼河北音书断,丹凤城南秋夜长。\n谁为含愁独不见,更教明月照流黄?", - "type": "七言律诗", - "author": "沈全期", - "title": "古意呈补阙乔知之" - }, - { - "id": 224, - "contents": "空山不见人,但闻人语响。\n返景入深林,复照青苔上。", - "type": "五言绝句", - "author": "王维", - "title": "鹿柴" - }, - { - "id": 225, - "contents": "独坐幽篁里,弹琴复长啸。\n深林人不知,明月来相照。", - "type": "五言绝句", - "author": "王维", - "title": "竹里馆" - }, - { - "id": 226, - "contents": "山中相送罢,日暮掩柴扉。\n春草明年绿,王孙归不归?", - "type": "五言绝句", - "author": "王维", - "title": "送别" - }, - { - "id": 227, - "contents": "红豆生南国,春来发几枝?\n愿君多采撷,此物最相思。", - "type": "五言绝句", - "author": "王维", - "title": "相思" - }, - { - "id": 228, - "contents": "君自故乡来,应知故乡事。\n来日绮窗前,寒梅著花未?", - "type": "五言绝句", - "author": "王维", - "title": "杂诗" - }, - { - "id": 229, - "contents": "归山深浅去,须尽丘壑美。\n莫学武陵人,暂游桃源里。", - "type": "五言绝句", - "author": "裴迪", - "title": "送崔九" - }, - { - "id": 230, - "contents": "终南阴岭秀,积雪浮云端。\n林表明霁色,城中增暮寒。", - "type": "五言绝句", - "author": "祖咏", - "title": "终南望馀雪" - }, - { - "id": 231, - "contents": "移舟泊烟渚,日暮客愁新。\n野旷天低树,江清月近人。", - "type": "五言绝句", - "author": "孟浩然", - "title": "宿建德江" - }, - { - "id": 232, - "contents": "春眠不觉晓,处处闻啼鸟。\n夜来风雨声,花落知多少?", - "type": "五言绝句", - "author": "孟浩然", - "title": "春晓" - }, - { - "id": 233, - "contents": "床前明月光,疑是地上霜。\n举头望明月,低头思故乡。", - "type": "五言绝句", - "author": "李白", - "title": "夜思" - }, - { - "id": 234, - "contents": "美人卷珠帘,深坐蹙蛾眉。\n但见泪痕湿,不知心恨谁?", - "type": "五言绝句", - "author": "李白", - "title": "怨情" - }, - { - "id": 235, - "contents": "功盖三分国,名成八阵图。\n江流石不转,遗恨失吞吴。", - "type": "五言绝句", - "author": "杜甫", - "title": "八阵图" - }, - { - "id": 236, - "contents": "白日依山尽,黄河入海流。\n欲穷千里目,更上一层楼。", - "type": "五言绝句", - "author": "王之涣", - "title": "登鹳雀楼" - }, - { - "id": 237, - "contents": "苍苍竹林寺,杳杳钟声晚。\n荷笠带斜阳,青山独归远。", - "type": "五言绝句", - "author": "刘长卿", - "title": "送灵澈" - }, - { - "id": 238, - "contents": "泠泠七弦上,静听松风寒。\n古调虽自爱,今人多不弹。", - "type": "五言绝句", - "author": "刘长卿", - "title": "弹琴" - }, - { - "id": 239, - "contents": "孤云将野鹤,岂向人间住!\n莫买沃洲山,时人已知处。", - "type": "五言绝句", - "author": "刘长卿", - "title": "送上人" - }, - { - "id": 240, - "contents": "怀君属秋夜,散步咏凉天。\n空山松子落,幽人应未眠。", - "type": "五言绝句", - "author": "韦应物", - "title": "秋夜寄邱员外" - }, - { - "id": 241, - "contents": "鸣筝金粟柱,素手玉房前。\n欲得周郎顾,时时误拂弦。", - "type": "五言绝句", - "author": "李端", - "title": "听筝" - }, - { - "id": 242, - "contents": "三日入厨下,洗手作羹汤。\n未谙姑食性,先遣小姑尝。", - "type": "五言绝句", - "author": "王建", - "title": "新嫁娘" - }, - { - "id": 243, - "contents": "昨夜裙带解,今朝[虫喜]子飞。\n铅华不可弃,莫是藁砧归。", - "type": "五言绝句", - "author": "权德舆", - "title": "玉台体" - }, - { - "id": 244, - "contents": "千山鸟飞绝,万径人踪灭。\n孤舟蓑笠翁,独钓寒江雪。", - "type": "五言绝句", - "author": "柳宗元", - "title": "江雪" - }, - { - "id": 245, - "contents": "寥落古行宫,宫花寂寞红。\n白头宫女在,闲坐说玄宗。", - "type": "五言绝句", - "author": "元稹", - "title": "行宫" - }, - { - "id": 246, - "contents": "绿蚁新醅酒,红泥小火炉。\n晚来天欲雪,能饮一杯无?", - "type": "五言绝句", - "author": "白居易", - "title": "问刘十九" - }, - { - "id": 247, - "contents": "故国三千里,深宫二十年。\n一声何满子,双泪落君前。", - "type": "五言绝句", - "author": "张祜", - "title": "何满子" - }, - { - "id": 248, - "contents": "向晚意不适,驱车登古原。\n夕阳无限好,只是近黄昏。", - "type": "五言绝句", - "author": "李商隐", - "title": "登乐游原" - }, - { - "id": 249, - "contents": "松下问童子,言师采药去。\n只在此山中,云深不知处。", - "type": "五言绝句", - "author": "贾岛", - "title": "寻隐者不遇" - }, - { - "id": 250, - "contents": "岭外音书绝,经冬复立春。\n近乡情更怯,不敢问来人。", - "type": "五言绝句", - "author": "李频", - "title": "渡汉江" - }, - { - "id": 251, - "contents": "打起黄莺儿,莫教枝上啼。\n啼时惊妾梦,不得到辽西。", - "type": "五言绝句", - "author": "金昌绪", - "title": "春怨" - }, - { - "id": 178, - "contents": "北斗七星高,哥舒夜带刀。\n至今窥牧马,不敢过临洮。", - "type": "七言律诗", - "author": "西鄙人", - "title": "哥舒歌" - }, - { - "id": 253, - "contents": "君家何处住,妾住在横塘。\n停船暂借问,或恐是同乡。", - "type": "五言绝句", - "author": "崔颢", - "title": "长干行二首之一" - }, - { - "id": 254, - "contents": "家临九江水,来去九江侧。\n同是长干人,生小不相识。", - "type": "五言绝句", - "author": "崔颢", - "title": "长干行二首之二" - }, - { - "id": 255, - "contents": "玉阶生白露,夜久侵罗袜。\n却下水晶帘,玲珑望秋月。", - "type": "五言绝句", - "author": "李白", - "title": "玉阶怨" - }, - { - "id": 256, - "contents": "鹫翎金仆姑,燕尾绣蝥弧。\n独立扬新令,千营共一呼。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之一" - }, - { - "id": 257, - "contents": "林暗草惊风,将军夜引弓。\n平明寻白羽,没在石棱中。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之二" - }, - { - "id": 258, - "contents": "月黑雁飞高,单于夜遁逃。\n欲将轻骑逐,大雪满弓刀。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之三" - }, - { - "id": 259, - "contents": "野幕蔽琼筵,羌戎贺劳旋。\n醉和金甲舞,雷鼓动山川。", - "type": "五言绝句", - "author": "卢纶", - "title": "塞下曲四首之四" - }, - { - "id": 260, - "contents": "嫁得瞿塘贾,朝朝误妾期。\n早知潮有信,嫁与弄潮儿。", - "type": "五言绝句", - "author": "李益", - "title": "江南曲" - }, - { - "id": 261, - "contents": "少小离家老大回,乡音无改鬓毛衰。\n儿童相见不相识,笑问客从何处来?", - "type": "七言绝句", - "author": "贺知章", - "title": "回乡偶书" - }, - { - "id": 262, - "contents": "隐隐飞桥隔野烟,石矶西畔问渔船。\n桃花尽日随流水,洞在清溪何处边?", - "type": "七言绝句", - "author": "张旭", - "title": "桃花溪" - }, - { - "id": 263, - "contents": "独在异乡为异客,每逢佳节倍思亲。\n遥知兄弟登高处,遍插茱萸少一人。", - "type": "七言绝句", - "author": "王维", - "title": "九月九日忆山东兄弟" - }, - { - "id": 264, - "contents": "寒雨连江夜入吴,平明送客楚山孤。\n洛阳亲友如相问,一片冰心在玉壶。", - "type": "七言绝句", - "author": "王昌龄", - "title": "芙蓉楼送辛渐" - }, - { - "id": 265, - "contents": "闺中少妇不知愁,春日凝妆上翠楼。\n忽见陌头杨柳色,悔教夫婿觅封侯。", - "type": "七言绝句", - "author": "王昌龄", - "title": "闺怨" - }, - { - "id": 266, - "contents": "昨夜风开露井桃,未央前殿月轮高。\n平阳歌舞新承宠,帘外春寒赐锦袍。", - "type": "七言绝句", - "author": "王昌龄", - "title": "春宫曲" - }, - { - "id": 267, - "contents": "葡萄美酒夜光杯,欲饮琵琶马上催。\n醉卧沙场君莫笑,古来征战几人回!", - "type": "七言绝句", - "author": "王翰", - "title": "凉州词" - }, - { - "id": 268, - "contents": "故人西辞黄鹤楼,烟花三月下扬州。\n孤帆远影碧空尽,惟见长江天际流。", - "type": "七言绝句", - "author": "李白", - "title": "送孟浩然之广陵" - }, - { - "id": 269, - "contents": "朝辞白帝彩云间,千里江陵一日还。\n两岸猿声啼不住,轻舟已过万重山。", - "type": "七言绝句", - "author": "李白", - "title": "下江陵" - }, - { - "id": 270, - "contents": "故园东望路漫漫,双袖龙钟泪不干。\n马上相逢无纸笔,凭君传语报平安。", - "type": "七言绝句", - "author": "岑参", - "title": "逢入京使" - }, - { - "id": 271, - "contents": "岐王宅里寻常见,崔九堂前几度闻。\n正是江南好风景,落花时节又逢君。", - "type": "七言绝句", - "author": "杜甫", - "title": "江南逢李龟年" - }, - { - "id": 272, - "contents": "独怜幽草涧边生,上有黄鹂深树鸣。\n春潮带雨晚来急,野渡无人舟自横。", - "type": "七言绝句", - "author": "韦应物", - "title": "滁州西涧" - }, - { - "id": 273, - "contents": "月落乌啼霜满天,江枫渔火对愁眠。\n姑苏城外寒山寺,夜半钟声到客船。", - "type": "七言绝句", - "author": "张继", - "title": "枫桥夜泊" - }, - { - "id": 274, - "contents": "春城无处不飞花,寒食东风御柳斜。\n日暮汉宫传蜡烛,轻烟散入五侯家。", - "type": "七言绝句", - "author": "韩□", - "title": "寒食" - }, - { - "id": 275, - "contents": "更深月色半人家,北斗阑干南斗斜。\n今夜偏知春气暖,虫声新透绿窗纱。", - "type": "七言绝句", - "author": "刘方平", - "title": "月夜" - }, - { - "id": 276, - "contents": "纱窗日落渐黄昏,金屋无人见泪痕。\n寂寞空庭春欲晚,梨花满地不开门。", - "type": "七言绝句", - "author": "刘方平", - "title": "春怨" - }, - { - "id": 277, - "contents": "岁岁金河复玉关,朝朝马策与刀环。\n三春白雪归青冢,万里黄河绕黑山。", - "type": "七言绝句", - "author": "柳中庸", - "title": "征人怨" - }, - { - "id": 278, - "contents": "玉楼天半起笙歌,风送宫嫔笑语和。\n月殿影开闻夜漏,水晶帘卷近秋河。", - "type": "七言绝句", - "author": "顾况", - "title": "宫词" - }, - { - "id": 279, - "contents": "回乐峰前沙似雪,受降城外月如霜。\n不知何处吹芦管,一夜征人尽望乡。", - "type": "七言绝句", - "author": "李益", - "title": "夜上受降城闻笛" - }, - { - "id": 280, - "contents": "朱雀桥边野草花,乌衣巷口夕阳斜。\n旧时王谢堂前燕,飞入寻常百姓家。", - "type": "七言绝句", - "author": "刘禹锡", - "title": "乌衣巷" - }, - { - "id": 281, - "contents": "新妆宜面下朱楼,深锁春光一院愁。\n行到中庭数花朵,蜻蜓飞上玉搔头。", - "type": "七言绝句", - "author": "刘禹锡", - "title": "春词" - }, - { - "id": 282, - "contents": "泪湿罗巾梦不成,夜深前殿按歌声。\n红颜未老恩先断,斜倚薰笼坐到明。", - "type": "七言绝句", - "author": "白居易", - "title": "后宫词" - }, - { - "id": 283, - "contents": "禁门宫树月痕过,媚眼惟看宿鹭窠。\n斜拔玉钗灯影畔,剔开红焰救飞蛾。", - "type": "七言绝句", - "author": "张祜", - "title": "赠内人" - }, - { - "id": 284, - "contents": "日光斜照集灵台,红树花迎晓露开。\n昨夜上皇新授□(“录”加竹头),太真含笑入帘来。", - "type": "七言绝句", - "author": "张祜", - "title": "集灵台二首之一" - }, - { - "id": 285, - "contents": "虢国夫人承主恩,平明骑马入宫门。\n却嫌脂粉污颜色,淡扫蛾眉朝至尊。", - "type": "七言绝句", - "author": "张祜", - "title": "集灵台二首之二" - }, - { - "id": 286, - "contents": "金陵津渡小山楼,一宿行人自可愁。\n潮落夜江斜月里,两三星火是瓜州。", - "type": "七言绝句", - "author": "张祜", - "title": "题金陵渡" - }, - { - "id": 287, - "contents": "寂寂花时闭院门,美人相并立琼轩。\n含情欲说宫中事,鹦鹉前头不敢言。", - "type": "七言绝句", - "author": "朱庆馀", - "title": "宫词" - }, - { - "id": 288, - "contents": "洞房昨夜停红烛,待晓堂前拜舅姑。\n妆罢低声问夫婿,画眉深浅入时无?", - "type": "七言绝句", - "author": "朱庆馀", - "title": "近试上张水部" - }, - { - "id": 289, - "contents": "清时有味是无能,闲爱孤云静爱僧。\n欲把一麾江海去,乐游原上望昭陵。", - "type": "七言绝句", - "author": "杜牧", - "title": "将赴吴兴登乐游原" - }, - { - "id": 290, - "contents": "折戟沈沙铁未销,自将磨洗认前朝。\n东风不与周郎便,铜雀春深销二乔。", - "type": "七言绝句", - "author": "杜牧", - "title": "赤壁" - }, - { - "id": 291, - "contents": "烟笼寒水月笼沙,夜泊秦淮近酒家。\n商女不知亡国恨,隔江犹唱《后庭花》。", - "type": "七言绝句", - "author": "杜牧", - "title": "泊秦淮" - }, - { - "id": 292, - "contents": "青山隐隐水迢迢,秋尽江南草未凋。\n二十四桥明月夜,玉人何处教吹箫?", - "type": "七言绝句", - "author": "杜牧", - "title": "寄扬州韩绰判官" - }, - { - "id": 293, - "contents": "落魄江湖载酒行,楚腰纤细掌中轻。\n十年一觉扬州梦,赢得青楼薄幸名。", - "type": "七言绝句", - "author": "杜牧", - "title": "遣怀" - }, - { - "id": 294, - "contents": "银烛秋光冷画屏,轻罗小扇扑流萤。\n天阶夜色凉如水,坐看牵牛织女星。", - "type": "七言绝句", - "author": "杜牧", - "title": "秋夕" - }, - { - "id": 295, - "contents": "娉娉袅袅十三馀,豆蔻梢头二月初。\n春风十里扬州路,卷上珠帘总不如。", - "type": "七言绝句", - "author": "杜牧", - "title": "赠别二首之一" - }, - { - "id": 296, - "contents": "多情却似总无情,唯觉樽前笑不成。\n蜡烛有心还惜别,替人垂泪到天明。", - "type": "七言绝句", - "author": "杜牧", - "title": "赠别二首之二" - }, - { - "id": 297, - "contents": "繁华事散逐香尘,流水无情草自春。\n日暮东风怨啼鸟,落花犹似坠楼人。", - "type": "七言绝句", - "author": "杜牧", - "title": "金谷园" - }, - { - "id": 298, - "contents": "君问归期未有期,巴山夜雨涨秋池。\n何当共剪西窗烛,却话巴山夜雨时?", - "type": "七言绝句", - "author": "李商隐", - "title": "夜雨寄北" - }, - { - "id": 299, - "contents": "嵩云秦树久离居,双鲤迢迢一纸笔。\n休问梁园旧宾客,茂陵秋雨病相如。", - "type": "七言绝句", - "author": "李商隐", - "title": "寄令狐郎中" - }, - { - "id": 300, - "contents": "为有云屏无限娇,凤城寒尽怕春宵。\n无端嫁得金龟婿,辜负香衾事早朝。", - "type": "七言绝句", - "author": "李商隐", - "title": "为有" - }, - { - "id": 301, - "contents": "乘兴南游不戒严,九重谁省谏书函?\n春风举国裁宫锦,半作障泥半作帆。", - "type": "七言绝句", - "author": "李商隐", - "title": "隋宫" - }, - { - "id": 302, - "contents": "瑶池阿母绮窗开,黄竹歌声动地哀。\n八骏日行三万里,穆王何事不重来?", - "type": "七言绝句", - "author": "李商隐", - "title": "瑶池" - }, - { - "id": 303, - "contents": "云母屏风烛影深,长河渐落晓星沈。\n嫦娥应悔偷灵药,碧海青天夜夜心。", - "type": "七言绝句", - "author": "李商隐", - "title": "嫦娥" - }, - { - "id": 304, - "contents": "宣室求贤访逐臣,贾生才调更无伦。\n可怜夜半虚前席,不问苍生问鬼神!", - "type": "七言绝句", - "author": "李商隐", - "title": "贾生" - }, - { - "id": 305, - "contents": "冰簟银床梦不成,碧天如水夜云轻。\n雁声远过潇湘去,十二楼中月自明。", - "type": "七言绝句", - "author": "温庭筠", - "title": "瑶瑟怨" - }, - { - "id": 306, - "contents": "玄宗回马杨妃死,云雨难忘日月新。\n终是圣明天子事,景阳宫井又何人?", - "type": "七言绝句", - "author": "郑畋", - "title": "马嵬坡" - }, - { - "id": 307, - "contents": "碧阑干外绣帘垂,猩色屏风画折枝。\n八尺龙须方锦褥,已凉天气未寒时。", - "type": "七言绝句", - "author": "韩□", - "title": "已凉" - }, - { - "id": 308, - "contents": "江雨霏霏江草齐,六朝如梦鸟空啼。\n无情最是台城柳,依旧烟笼十里堤。", - "type": "七言绝句", - "author": "韦庄", - "title": "金陵图" - }, - { - "id": 309, - "contents": "誓扫匈奴不顾身,五千貂锦丧胡尘。\n可怜无定河边骨,犹是深闺梦里人!", - "type": "七言绝句", - "author": "陈陶", - "title": "陇西行" - }, - { - "id": 310, - "contents": "别梦依依到谢家,小廊回合曲阑斜。\n多情只有春庭月,犹为离人照落花。", - "type": "七言绝句", - "author": "张泌", - "title": "寄人" - }, - { - "id": 311, - "contents": "尽寒食雨草萋萋,著麦苗风柳映堤。\n等是有家归未得,杜鹃休向耳边啼。", - "type": "七言绝句", - "author": "无名氏", - "title": "杂诗" - }, - { - "id": 312, - "contents": "渭城朝雨[氵邑]轻尘,客舍青青柳色新。\n劝君更尽一杯酒,西出阳关无故人。", - "type": "七言绝句", - "author": "王维", - "title": "渭城曲" - }, - { - "id": 313, - "contents": "桂魄初生秋露微,轻罗已薄未更衣。\n银筝夜久殷勤弄,心怯空房不忍归!", - "type": "七言绝句", - "author": "王维", - "title": "秋夜曲" - }, - { - "id": 314, - "contents": "奉帚平明金殿开,且将团扇共徘徊。\n玉颜不及寒鸦色,犹带昭阳日影来。", - "type": "七言绝句", - "author": "王昌龄", - "title": "长信怨" - }, - { - "id": 315, - "contents": "秦时明月汉时关,万里长征人未还。\n但使龙城飞将在,不教胡马渡阴山!", - "type": "七言绝句", - "author": "王昌龄", - "title": "出塞" - }, - { - "id": 316, - "contents": "黄河远上白云间,一片孤城万仞山。\n羌笛何须怨杨柳?春风不度玉门关。", - "type": "七言绝句", - "author": "王之涣", - "title": "出塞" - }, - { - "id": 317, - "contents": "云想衣裳花想容,春风拂槛露华浓。\n若非群玉山头见,会向瑶台月下逢。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之一" - }, - { - "id": 318, - "contents": "一枝红艳露凝香,云雨巫山枉断肠。\n借问汉宫谁得似?可怜飞燕倚新妆。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之二" - }, - { - "id": 319, - "contents": "名花倾国两相欢,常得君王带笑看。\n解释春风无限恨,沈香亭北倚阑干。", - "type": "七言绝句", - "author": "李白", - "title": "清平调三首之三" - }, - { - "id": 320, - "contents": "劝君莫惜金缕衣,劝君惜取少年时。\n花开堪折直须折,莫待无花空折枝!", - "type": "七言绝句", - "author": "杜秋娘", - "title": "金缕衣" - } -] - diff --git a/exercises/1901100023/README.md b/exercises/1901100023/README.md index c5973fc24..659796763 100644 --- a/exercises/1901100023/README.md +++ b/exercises/1901100023/README.md @@ -1,35 +1 @@ -# 学习总结 -6月底报名Python入门课程,今天是9月7日,课程结束。 - -这次学习经历的最大收获——预算观念和模仿。 - -## 预算观念很重要,要给自学留出足够的预算 -报名课程之后,我立即加了“新生小咨询”,想了解一下平均完成每天作业所需要的时间。当时ta给的数据:一般每天2h左右可以完成,也有人会选择在周末集中完成几天的作业。 -我当时心中还轻快了一会儿,这个“平均人”的水平我总能达到吧? -7月整个月有事外出,虽然白天基本有安排,但我思忖着每天匀出2h总是不成问题的。 - -**Plan1.0**:总共14天的任务,考虑到特殊情况,就2天完成一个任务,预计在7月就能顺利结业。 - -现实:整个7月只完成了DAY1…… -DAY记录是在7月2日,共计3h(这时间还不包括提交作业之后的折腾)。上手才知道自己的笨拙,明明参考资料将每一步都写明白了,但操作还是漏洞百出。我创建了至少有三四个hello-world仓库吧?因为前几个弄错了又删不掉… 真的很崩溃很打击,要知道我可是打了一个月搞定14天的鸡血,竟然卡在了第一天???幸好有辅导员的及时回复,之后参考教学视频,跟着操作,再加上搜索,成功删掉了多余的仓库。 -DAY1只是个小打击,我尚未打算修改计划。DAY2装个软件出现“安装过程出错”的问题,重新装了五六次还是不行,当时问了辅导员和教练,都未能解决…… 那两天真的心焦,我软件都没装好可怎么走下去T T -总算决定了,把这个事情放一放。等到8月份回家有大块时间的时候再学习课程。 - -**plan2.0**:在8月内完成作业,每个任务预计4h。(8月份自己主要的事情:工作日去医院见习+考驾驶证) - -现实:DAY2前后处理8.5h,DAY3:13.5h,DAY4:9h,DAY5:17h(加上阅读部分《自学是门手艺》),DAY6:8h。有2/3以上的时间花在阅读参考资料。 - -**plan3.0**:无计划。有时间尽量去写作业,反正遇到的困难我是难以估计的…… - -现在阅读笑来老师在《自学是门手艺》上Part.2.笨拙与耐心这一篇,真的深刻了。预算观念非常重要,想要学好一门技术必须给出足够的预算,自己在学习过程中的不舒服不过是因为没有给出足够的预算,一旦超出了“以为”的时间范围,焦虑就不可避免了。 - -## 模仿未必简单 -模仿行为虽然已经是最初级的学习模式,但它未必就简单。 - -在DAY6之后我认识到了自己的水平,靠阅读参考资料写作业于我而言行不通,我开始参考其他同学已经上传的作业,看看用了哪些语句、为什么要用、我能否直接用ta的代码。 -我觉得我这就是一个模仿行为,貌似很简单了,但还是会出现意想不到的问题,因为参考的作业并不是从头到尾都能用的。还需要自己挑选着敲进去、尝试,出现差错再去搜索解决,或者换一款代码继续尝试。 -DAY13的作业我卡在matplotlib 图表中文不显示问题上近2h,issue区确实提供了许多解决方案,但我将链接点开一一尝试也未成功,最终在相关页面中找到了适合自己的解决方法。 - - -最后,感谢Python自学训练营,感谢笑来老师,感谢辅导员、教练等所有为这个课程工作的人! -这段时间对自己心态的磨炼是最大的收获,这个课程真的 超值! +# hello-world-B \ No newline at end of file diff --git a/exercises/1901100023/d12/main.py b/exercises/1901100023/d12/main.py deleted file mode 100644 index 2b3b266a1..000000000 --- a/exercises/1901100023/d12/main.py +++ /dev/null @@ -1,47 +0,0 @@ -''' -import os -from mymodule import stats_word -from collections import Counter -import json - -path = '/Users/hannaspc/Documents/Python/DAY10/d10/tang300.json' -with open (path, 'r', encoding='UTF-8') as f: # 不加'r', encoding='UTF-8'会报UnicodeDecodeError - text = f.read() - -# 捕获异常 -try: - stats_word.stats_text(text1,20) -except ValueError: - print('Error:文本非字符串') -''' - - -# day12 -from wxpy import * -import requests -import getpass -from pyquery import PyQuery -from mymodule import stats_word - -bot = Bot() #登录微信的命令 -my_friends = bot.friends().search('韩翊婷') #搜索名称含有“大头鬼啊-”的好友。bot.friends()→发送给所有好友 -#给好友发送信息 -#my_friends.send('你好') - -#监听好友消息 -#通过装饰器,注册一个接收制定好友分享消息的函数 -@bot.register(my_friends, SHARING) -def friend_sharing(msg): - # 使用requests获得网络链接的文本 - address = msg.url - r = requests.get(address) - document = PyQuery(r.text) - content = document('#js_content').text() - # 将获得的文章进行分词处理 - a = stats_word.stats_text_cn(content, 100) - b = str(a) - # 给好友发消息 - my_friends.send(b) -# 让程序保持运行 -embed() # 进入Python命令行 - diff --git a/exercises/1901100023/d12/mymodule/stats_word.py b/exercises/1901100023/d12/mymodule/stats_word.py deleted file mode 100644 index 86c64cf82..000000000 --- a/exercises/1901100023/d12/mymodule/stats_word.py +++ /dev/null @@ -1,75 +0,0 @@ -en_text= ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex.s -Complex is better than complicated. 9 Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -cn_text = ''' -愚公移山 How The Foolish Old Man Moved Mountains -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大力神揹走二山。 -''' - - -import re -import jieba -from collections import Counter - -def stats_text_en(text, count): -# 2. 实现该函数的功能(同day5任务2):统计参数中每个英⽂文单词出现的次数,最后返回⼀个按词频 降序 排列列的 数组 - if type(text) != str: - raise ValueError('非字符串类型') - text=re.sub('[^a-zA-Z]',' ',text.strip()) #表示所有非英文字母 - words=text.split() - - return Counter(words).most_common(count) - - -def stats_text_cn(text,count): - if type(text) != str: - raise ValueError('非字符串类型') - - text=re.sub('[^\u4e00-\u9fa5]','',text) #[^\u4e00-\u9fa5]表示所有非中文。注意 中间' '有空格的~ - text=jieba.lcut(text) # 精确切分中文,返回一个list - text1=[] - for i in text: #筛选长度大于等于2的词 - if len(i)>=2: - text1.append(i) - - return Counter(text1).most_common(count) - - - - - -def stats_text(text,count): - if type(text) != str: - raise ValueError('非字符串类型') - print(stats_text_en(text,count)) - print(stats_text_cn(text,count)) diff --git a/exercises/1901100023/d13/main.py b/exercises/1901100023/d13/main.py deleted file mode 100644 index 2fb069be6..000000000 --- a/exercises/1901100023/d13/main.py +++ /dev/null @@ -1,69 +0,0 @@ -# day12 -from os import path -from wxpy import * -import requests -import getpass -from pyquery import PyQuery -from mymodule import stats_word -import matplotlib.pyplot as plt -import numpy as np - - -# 获取当前工作目录 -cwd = path.abspath(path.dirname(__file__)) -# 设置中文字体(因为matplotlib默认不支持中文字体) -import matplotlib -plt.rcParams['font.family'] = ['Arial Unicode MS'] - - -# 提取微信公众号文章正文 -def get_article(url): - r = requests.get(url) - document = PyQuery(r.text) - return document('#js_content').text() - - -# 生成图片 -def generate_image(data, image_path): - labels = [v[0] for v in data] # 获得每个元组里的第一个值 - widths = [v[1] for v in data] # 获得第二个值(出现的次数)作为x轴的值 - ypos = range(len(data)) # 获取y轴有多少元素,就生成多少行 - fig, ax = plt.subplots() # 初始化一个图标 - ax.barh(ypos, widths) # ax就是生成的坐标系 - ax.set_yticks(ypos) - ax.set_yticklabels(labels) - ax.invert_yaxis() # 默认是从小到大的so这里invert一下 - ax.set_ylabel('关键字') - ax.set_xlabel('词频') - ax.set_title('词频统计') - fig.savefig(image_path, bbox_inches='tight') - - -def main(): - bot = Bot() #登录微信的命令 - my_friends = bot.friends().search('大头鬼啊') #搜索名称含有“大头鬼啊-”的好友。bot.friends()→发送给所有好友 -#监听好友消息 -#通过装饰器,注册一个接收制定好友分享消息的函数 - @bot.register(my_friends, SHARING) - def friend_sharing(msg): - # 使用requests获得网络链接的文本 - article = get_article(msg.url) - result = stats_word.stats_text_cn(article, 10) - image_path = path.join(cwd, 'stats.png') - generate_image(result, image_path) - msg.reply_image(image_path) -# 让程序保持运行。如果不加这一句,程序运行完就会退出。 - embed() - - -def test(): - article = get_article('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - result = stats_word.stats_text_cn(article, 10) - image_path = path.join(cwd, 'stats.png') - generate_image(result, image_path) - -if __name__ == "__main__": - # main() - test() - - diff --git a/exercises/1901100023/d13/mymodule/stats_word.py b/exercises/1901100023/d13/mymodule/stats_word.py deleted file mode 100644 index 86c64cf82..000000000 --- a/exercises/1901100023/d13/mymodule/stats_word.py +++ /dev/null @@ -1,75 +0,0 @@ -en_text= ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex.s -Complex is better than complicated. 9 Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -cn_text = ''' -愚公移山 How The Foolish Old Man Moved Mountains -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大力神揹走二山。 -''' - - -import re -import jieba -from collections import Counter - -def stats_text_en(text, count): -# 2. 实现该函数的功能(同day5任务2):统计参数中每个英⽂文单词出现的次数,最后返回⼀个按词频 降序 排列列的 数组 - if type(text) != str: - raise ValueError('非字符串类型') - text=re.sub('[^a-zA-Z]',' ',text.strip()) #表示所有非英文字母 - words=text.split() - - return Counter(words).most_common(count) - - -def stats_text_cn(text,count): - if type(text) != str: - raise ValueError('非字符串类型') - - text=re.sub('[^\u4e00-\u9fa5]','',text) #[^\u4e00-\u9fa5]表示所有非中文。注意 中间' '有空格的~ - text=jieba.lcut(text) # 精确切分中文,返回一个list - text1=[] - for i in text: #筛选长度大于等于2的词 - if len(i)>=2: - text1.append(i) - - return Counter(text1).most_common(count) - - - - - -def stats_text(text,count): - if type(text) != str: - raise ValueError('非字符串类型') - print(stats_text_en(text,count)) - print(stats_text_cn(text,count)) diff --git a/exercises/1901100024/1001S02E05_stats_text.py b/exercises/1901100024/1001S02E05_stats_text.py index 43c46a809..fd8efef73 100644 --- a/exercises/1901100024/1001S02E05_stats_text.py +++ b/exercises/1901100024/1001S02E05_stats_text.py @@ -47,4 +47,4 @@ print('英文单词出现的次数 ==>',counter) -print('从小到大输出所有的单词及出现的次数 ==>',sorted(counter.items(),key=lambda x:x[1],reverse=True)) \ No newline at end of file +print('从小到大输出所有的单词及出现的次数 ==>',sorted(counter.items(),key=lambda x:x[1],reverse=True)) diff --git a/exercises/1901100042/d10/main.py b/exercises/1901100042/d10/main.py deleted file mode 100644 index 36d53a776..000000000 --- a/exercises/1901100042/d10/main.py +++ /dev/null @@ -1,10 +0,0 @@ -from mymodule import stats_word - -if __name__ == '__main__': - with open('C:/Users/Github/selfteaching-python-camp/exercises/1901100042/d09/tang300.json',encoding='UTF-8') as f: - text = f.read() - - print('统计中文词频:',) - print(stats_word.stats_text_cn(text, 20)) - - \ No newline at end of file diff --git a/exercises/1901100042/d10/mymodule/stats_word.py b/exercises/1901100042/d10/mymodule/stats_word.py deleted file mode 100644 index 8d368f356..000000000 --- a/exercises/1901100042/d10/mymodule/stats_word.py +++ /dev/null @@ -1,42 +0,0 @@ -from collections import Counter -import jieba#引入jieba -#定义一个统计参数中每个英文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_en(text,count): - #首先判断text类型,如果不是str,抛出ValueError - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - - elements = text.split() - words =[] - symbols = ',.!*-?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -#定义一个统计参数中每个中文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_cn(text,count): - #同样先判断text类型 - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - cn_elements = [] -#中文直接指定unicode中的中文范围 英文是否可以同样进行指定Unicode范围操作? -#英文unicode对应的只有字母,没有单词,所以利用上述方法统计单词出现频数。 - cn_cut =jieba.cut(text,cut_all=False) - for cn_element in cn_cut: - if '\u4e00' <= cn_element <= '\u9fef' and len(cn_element)>=2: - cn_elements.append(cn_element) - return Counter(cn_elements).most_common(count) - - -#输出合并词频统计 -def stats_text(text,count): - #同样先判断text类型 - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - return stats_text_en(text,count)+stats_text_cn(text,count) - - diff --git a/exercises/1901100042/d11/main.py b/exercises/1901100042/d11/main.py deleted file mode 100644 index 6c636200a..000000000 --- a/exercises/1901100042/d11/main.py +++ /dev/null @@ -1,33 +0,0 @@ -import getpass -import yagmail -import stats_word -import logging -import requests -import pyquery - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG) - -#提取微信公众号文章正文 -def get_article(): - words = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - document = pyquery.PyQuery(words.text) - return document('#js_content').text() - -def main(): - try: - article = get_article() - result = stats_word.stats_text_cn(article,10) - logging.info("%s %s",type(result),str(result)) - - #下面为发邮件内容 - sender =input('请输入您的邮箱地址:') - password = getpass.getpass('请输入您的密码(可复制):') - recipients = input ('请输入收件人邮箱地址:') - yag = yagmail.SMTP(sender,password,'smtp.qq.com') - yag.send(recipients,'自学训练营学习13群 1901100042',str(result)) - logging.info("邮件已发送,请查收!") - except Exception as e: - logging.exception(e) - -if __name__ == '__main__': - main() diff --git a/exercises/1901100042/d11/stats_word.py b/exercises/1901100042/d11/stats_word.py deleted file mode 100644 index 8d368f356..000000000 --- a/exercises/1901100042/d11/stats_word.py +++ /dev/null @@ -1,42 +0,0 @@ -from collections import Counter -import jieba#引入jieba -#定义一个统计参数中每个英文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_en(text,count): - #首先判断text类型,如果不是str,抛出ValueError - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - - elements = text.split() - words =[] - symbols = ',.!*-?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -#定义一个统计参数中每个中文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_cn(text,count): - #同样先判断text类型 - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - cn_elements = [] -#中文直接指定unicode中的中文范围 英文是否可以同样进行指定Unicode范围操作? -#英文unicode对应的只有字母,没有单词,所以利用上述方法统计单词出现频数。 - cn_cut =jieba.cut(text,cut_all=False) - for cn_element in cn_cut: - if '\u4e00' <= cn_element <= '\u9fef' and len(cn_element)>=2: - cn_elements.append(cn_element) - return Counter(cn_elements).most_common(count) - - -#输出合并词频统计 -def stats_text(text,count): - #同样先判断text类型 - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - return stats_text_en(text,count)+stats_text_cn(text,count) - - diff --git a/exercises/1901100042/d12/main.py b/exercises/1901100042/d12/main.py deleted file mode 100644 index e3c0f7474..000000000 --- a/exercises/1901100042/d12/main.py +++ /dev/null @@ -1,33 +0,0 @@ -import getpass -import yagmail -import stats_word -import logging -import requests -import pyquery -from wxpy import * - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG) - -#提取文章正文 -def get_article(url): - words = requests.get(url) - document = pyquery.PyQuery(words.text) - return document('#js_content').text() - -def main(): - bot = Bot() - friends = bot.friends() - - @bot.register(friends,SHARING) - def handler(msg): - try: - article = get_article(msg.url) - result = stats_word.stats_text_cn(article,100) - logging.info('sharing url =%s',msg.url) - msg.reply(str(result)) - except Exception as e: - logging.exception(e) - embed() - -if __name__ == '__main__': - main() diff --git a/exercises/1901100042/d12/stats_word.py b/exercises/1901100042/d12/stats_word.py deleted file mode 100644 index 8d368f356..000000000 --- a/exercises/1901100042/d12/stats_word.py +++ /dev/null @@ -1,42 +0,0 @@ -from collections import Counter -import jieba#引入jieba -#定义一个统计参数中每个英文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_en(text,count): - #首先判断text类型,如果不是str,抛出ValueError - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - - elements = text.split() - words =[] - symbols = ',.!*-?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -#定义一个统计参数中每个中文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_cn(text,count): - #同样先判断text类型 - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - cn_elements = [] -#中文直接指定unicode中的中文范围 英文是否可以同样进行指定Unicode范围操作? -#英文unicode对应的只有字母,没有单词,所以利用上述方法统计单词出现频数。 - cn_cut =jieba.cut(text,cut_all=False) - for cn_element in cn_cut: - if '\u4e00' <= cn_element <= '\u9fef' and len(cn_element)>=2: - cn_elements.append(cn_element) - return Counter(cn_elements).most_common(count) - - -#输出合并词频统计 -def stats_text(text,count): - #同样先判断text类型 - if not isinstance(text,str): - raise ValueError('输入的参数类型必须为str,当前参数类型为%s'%type(text)) - return stats_text_en(text,count)+stats_text_cn(text,count) - - diff --git a/exercises/1901100042/d13/main.py b/exercises/1901100042/d13/main.py deleted file mode 100644 index d310ac38f..000000000 --- a/exercises/1901100042/d13/main.py +++ /dev/null @@ -1,53 +0,0 @@ -from os import path -import logging -import requests -import matplotlib.pylot as plt -import pyquery -from wxpy import * -import stats_word - -logging.basicConfig(format='file:%(filename)s|line"%(lineno)d|message:%(message)s',level=logging.DEBUG) - -#获取当前工作目录 -cwd = path.abspath(path.dirname(__file__)) -#设置中文字体 -plt.rcParams['font.asns.serif'] = 'SimHei' - -#提取微信公众号文章 -def get_article(url): - r = requests.get(url) - document = pyquery.pyQuery(r.text) - return document('#js_content').text() - -#生成图片 -def generate_image(data,image_path): - labels = [v[0] for v in data] - widths = [v[1] for v in data] - ypos = range(len(data)) - fig,ax = plt.subplots() - ax.barh(ypos,widths) - ax.set_yticks(ypos) - ax.set_yticklabels(labels) - ax.invert_yaxis() - ax.set_ylabel('关键字') - ax.set_xlabel('词频') - ax.set_title('词频统计') - fig.savefig(image_path,bbox_inches='tight') - -def main(): - bot = Bot() - friends = bot.friends() - - @bot.register(friends,SHARING) - def handler(msg): - try: - logging.info('sharining url = %s',msg.url) - article = get_article(mag.url) - result = stats_word.stats_text_cn(article,100) - msg.reply(str(result)) - except Exception as e: - logging.exception(e) - embed() - -if __name__ =='__main__': - main() diff --git a/exercises/1901100042/d13/mymodule/stats_word.py b/exercises/1901100042/d13/mymodule/stats_word.py deleted file mode 100644 index c31aebcc4..000000000 --- a/exercises/1901100042/d13/mymodule/stats_word.py +++ /dev/null @@ -1,36 +0,0 @@ -from collections import Counter -import jieba - -#定义一个统计参数中每个英文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_en(text,count): - elements = text.split() - words =[] - - symbols = ',.!*-?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -#定义一个统计参数中每个中文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_cn(text,count): - cn_elements = [] - words =jieba.cut(text) - for cn_element in words: - if '\u4e00' <= cn_element <= '\u9fef': - cn_elements.append(cn_element) - return Counter(cn_elements).most_commom(count) - - - -#输出合并词频统计 -def stats_text(text,count): - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型 %s' %type(text)) - return stats_text_en(text,count)+stats_text_cn(text,count) - - - diff --git a/exercises/1901100042/d13/stats_word.py b/exercises/1901100042/d13/stats_word.py deleted file mode 100644 index c31aebcc4..000000000 --- a/exercises/1901100042/d13/stats_word.py +++ /dev/null @@ -1,36 +0,0 @@ -from collections import Counter -import jieba - -#定义一个统计参数中每个英文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_en(text,count): - elements = text.split() - words =[] - - symbols = ',.!*-?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -#定义一个统计参数中每个中文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_cn(text,count): - cn_elements = [] - words =jieba.cut(text) - for cn_element in words: - if '\u4e00' <= cn_element <= '\u9fef': - cn_elements.append(cn_element) - return Counter(cn_elements).most_commom(count) - - - -#输出合并词频统计 -def stats_text(text,count): - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型 %s' %type(text)) - return stats_text_en(text,count)+stats_text_cn(text,count) - - - diff --git a/exercises/1901100050/d08/main.py b/exercises/1901100050/d08/main.py index 6be61f0bd..e26bda28b 100644 --- a/exercises/1901100050/d08/main.py +++ b/exercises/1901100050/d08/main.py @@ -15,9 +15,7 @@ def test_traceback(): def test_logger(): try: stats_word.stats_text(1) - - except Exception as e: - + except exception as e: # print('test_logger =>',e) logger.exception(e) diff --git a/exercises/1901100050/d09/main.py b/exercises/1901100050/d09/main.py deleted file mode 100644 index 72eaad146..000000000 --- a/exercises/1901100050/d09/main.py +++ /dev/null @@ -1,35 +0,0 @@ -from mymodule import stats_word -from os import path -import json -import re -import logging - -logging.basicConfig( - format='file:%(filename)s|line:%(lineno)d|message:%(message)s', level=logging.DEBUG) - -def load_file(): - file_path = path.join(path.dirname(path.abspath(__file__)),'tang300.json') - print('当前文件路径:', __file__, '\n读取文件路径:', file_path) - - with open(file_path, 'r', encoding='utf-8') as f: - return f.read() - -def merge_poems(date): - poems = '' - for item in date: - poems += item.get('contents', '') - return poems - -def main(): - try: - data = load_file() - logging.info(data[0]) - poems = merge_poems(json.loads(data)) - logging.info('result ==> %s', stats_word.stats_text_cn(poems,100)) - except Exception as e: - logging.exception(e) - -if __name__ == '__main__': - main() - - diff --git a/exercises/1901100050/d09/mymodule/stats_word.py b/exercises/1901100050/d09/mymodule/stats_word.py deleted file mode 100644 index b9b2a02ed..000000000 --- a/exercises/1901100050/d09/mymodule/stats_word.py +++ /dev/null @@ -1,34 +0,0 @@ -from collections import Counter - -# 统计参数中每个英⽂单词出现的次数 -def stats_text_en(text, count): - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - # 用 str 类型 的 isascii 方法判断是否是英文单词 - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text, count): - cn_characters = [] - for character in text: - # unicode 中 中文 字符的范围 - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - return Counter(cn_characters).most_common(count) - -def stats_text(text): - ''' - 合并 英文词频 和 中文词频 的结果 - ''' - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text, count) + stats_text_cn(text, count) - - diff --git a/exercises/1901100050/d10/main.py b/exercises/1901100050/d10/main.py deleted file mode 100644 index b09e1addf..000000000 --- a/exercises/1901100050/d10/main.py +++ /dev/null @@ -1,33 +0,0 @@ -from mymodule import stats_word -from os import path -import json -import re -import logging - -logging.basicConfig( - format='file:%(filename)s|line:%(lineno)d|message:%(message)s', level=logging.DEBUG) - -def load_file(): - file_path = path.join(path.dirname(path.abspath(__file__)),'tang300.json') - print('当前文件路径:', __file__, '\n读取文件路径:', file_path) - - with open(file_path, 'r', encoding='utf-8') as f: - return f.read() - -def merge_poems(date): - poems = '' - for item in date: - poems += item.get('contents', '') - return poems - -def main(): - try: - data = load_file() - logging.info(data[0]) - poems = merge_poems(json.loads(data)) - logging.info('result ==> %s', stats_word.stats_text_cn(poems,100)) - except Exception as e: - logging.exception(e) - -if __name__ == '__main__': - main() diff --git a/exercises/1901100050/d10/mymodule/stats_word.py b/exercises/1901100050/d10/mymodule/stats_word.py deleted file mode 100644 index acb568440..000000000 --- a/exercises/1901100050/d10/mymodule/stats_word.py +++ /dev/null @@ -1,35 +0,0 @@ -from collections import Counter -import jieba - -# 统计参数中每个英⽂单词出现的次数 -def stats_text_en(text, count): - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - # 用 str 类型 的 isascii 方法判断是否是英文单词 - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text, count): - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i) > 1: - tmp.append(i) - return Counter(tmp).most_common(count) - -def stats_text(text): - ''' - 合并 英文词频 和 中文词频 的结果 - ''' - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text, count) + stats_text_cn(text, count) - - diff --git a/exercises/1901100050/d11/main.py b/exercises/1901100050/d11/main.py deleted file mode 100644 index 5329a9515..000000000 --- a/exercises/1901100050/d11/main.py +++ /dev/null @@ -1,35 +0,0 @@ -import yagmail -import requests -import pyquery -import getpass -import logging -from mymodule import stats_word - -# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests yagmail pyquery lxml - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s', level=logging.DEBUG) - -# 提取微信公众号文章正文 -def get_article(): - r = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - document = pyquery.PyQuery(r.text) - return document('#js_content').text() - -def main(): - try: - article = get_article() - result = stats_word.stats_text_cn(article, 10) - logging.info('%s %s', type(result), str(result)) - sender = input('请输入发件人邮箱:') - # 为了保护密码,输入密码的时候不会显示出来,直接输入,完成后按回车就行 - password = getpass.getpass('请输入发件人邮箱密码: ') - recipients = input('请输入收件人邮箱:') - yag = yagmail.SMTP(sender, password, 'smtp.163.com') - yag.send(recipients, '【1901100050】自学训练营学习13群 DAY11 lisq2018', str(result)) - logging.info('已发送,请注意查收。') - except Exception as e: - logging.exception(e) - - -if __name__ == "__main__": - main() diff --git a/exercises/1901100050/d11/mymodule/stats_word.py b/exercises/1901100050/d11/mymodule/stats_word.py deleted file mode 100644 index acb568440..000000000 --- a/exercises/1901100050/d11/mymodule/stats_word.py +++ /dev/null @@ -1,35 +0,0 @@ -from collections import Counter -import jieba - -# 统计参数中每个英⽂单词出现的次数 -def stats_text_en(text, count): - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - # 用 str 类型 的 isascii 方法判断是否是英文单词 - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text, count): - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i) > 1: - tmp.append(i) - return Counter(tmp).most_common(count) - -def stats_text(text): - ''' - 合并 英文词频 和 中文词频 的结果 - ''' - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text, count) + stats_text_cn(text, count) - - diff --git a/exercises/1901100050/d12/main.py b/exercises/1901100050/d12/main.py deleted file mode 100644 index 0885c5398..000000000 --- a/exercises/1901100050/d12/main.py +++ /dev/null @@ -1,32 +0,0 @@ -import logging -import requests -import pyquery -from wxpy import * -from mymodule import stats_word - - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s', level=logging.DEBUG) - -# 提取微信公众号文章正文 -def get_article(url): - r = requests.get(url) - document = pyquery.PyQuery(r.text) - return document('#js_content').text() - -def main(): - bot = Bot() - friends = bot.friends() - - @bot.register(friends,SHARING) - def handler(msg): - try: - logging.info('sharing url = %s', msg.url) - article = get_article(msg.url) - result = stats_word.stats_text_cn(article, 100) - msg.reply(str(result)) - except Exception as e: - logging.exception(e) - embed() - -if __name__ == "__main__": - main() diff --git a/exercises/1901100050/d12/mymodule/stats_word.py b/exercises/1901100050/d12/mymodule/stats_word.py deleted file mode 100644 index acb568440..000000000 --- a/exercises/1901100050/d12/mymodule/stats_word.py +++ /dev/null @@ -1,35 +0,0 @@ -from collections import Counter -import jieba - -# 统计参数中每个英⽂单词出现的次数 -def stats_text_en(text, count): - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - # 用 str 类型 的 isascii 方法判断是否是英文单词 - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text, count): - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i) > 1: - tmp.append(i) - return Counter(tmp).most_common(count) - -def stats_text(text): - ''' - 合并 英文词频 和 中文词频 的结果 - ''' - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text, count) + stats_text_cn(text, count) - - diff --git a/exercises/1901100050/d13/main.py b/exercises/1901100050/d13/main.py deleted file mode 100644 index 8f56b481a..000000000 --- a/exercises/1901100050/d13/main.py +++ /dev/null @@ -1,69 +0,0 @@ -from os import path -import logging -import requests -import matplotlib.pyplot as plt -import pyquery -from wxpy import * -from mymodule import stats_word - - - - -# 获取当前工作目录 -cwd = path.abspath(path.dirname(__file__)) -# 设置中文字体 -plt.rcParams['font.sans-serif'] = 'SimHei' - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s', level=logging.DEBUG) - - -# 提取微信公众号文章正文 -def get_article(url): - r = requests.get(url) - document = pyquery.PyQuery(r.text) - return document('#js_content').text() - - -# 制成图片 -def generate_image(data, image_path): - labels = [v[0] for v in data] - widths = [v[1] for v in data] - ypos = range(len(data)) - fig, ax = plt.subplots() - ax.barh(ypos, widths) - ax.set_yticks(ypos) - ax.set_yticklabels(labels) - ax.invert_yaxis() - ax.set_ylabel('关键字') - ax.set_xlabel('词频') - ax.set_title('词频统计') - fig.savefig(image_path, bbox_inches='tight') - - -def main(): - bot = Bot() - friends = bot.friends() - - @bot.register(friends,SHARING) - def handler(msg): - try: - logging.info('sharing url = %s', msg.url) - article = get_article(msg.url) - result = stats_word.stats_text_cn(article, 20) - image_path = path.join(cwd, 'stats.png') - generate_image(image_path) - msg.reply(str(result)) - except Exception as e: - logging.exception(e) - embed() - - -def test(): - article = get_article('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - result = stats_word.stats_text_cn(article, 20) - image_path = path.join(cwd, 'stats.png') - generate_image(result, image_path) - -if __name__ == "__main__": - main() - # test() diff --git a/exercises/1901100050/d13/mymodule/stats_word.py b/exercises/1901100050/d13/mymodule/stats_word.py deleted file mode 100644 index acb568440..000000000 --- a/exercises/1901100050/d13/mymodule/stats_word.py +++ /dev/null @@ -1,35 +0,0 @@ -from collections import Counter -import jieba - -# 统计参数中每个英⽂单词出现的次数 -def stats_text_en(text, count): - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - # 用 str 类型 的 isascii 方法判断是否是英文单词 - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text, count): - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i) > 1: - tmp.append(i) - return Counter(tmp).most_common(count) - -def stats_text(text): - ''' - 合并 英文词频 和 中文词频 的结果 - ''' - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text, count) + stats_text_cn(text, count) - - diff --git a/exercises/1901100064/README.md b/exercises/1901100064/README.md index 2a7ad29d0..e69de29bb 100644 --- a/exercises/1901100064/README.md +++ b/exercises/1901100064/README.md @@ -1,24 +0,0 @@ -2019.9.17 ҵѧܽ -һڡѧ -ѧǶѧϰΪӦѧϰܹһԴΪԼѧϰ -ǧҪѧϰ -ѧϰҲѧϰҸоѧԱ֮Ľձƫ١Ǵ󲿷ʱ -ﶼڶѧϰǾʧȥ˹ͬѧϰ塣 - -Ķο -ڱѧϰУȷʵӦþ߱ĶӢĵdzѧʱӦȴĶ -ĵʼ𲽽׶λỨ̫ʱ䣬±롣 -ĵʣȥӢĵ -ڳΪ֮󣬿ȥоӢĵ - - -ҷ̵֣Ļ˼ľ̵̡ȹѧϰĻ˼һµġѭ -һϵе﷨׼淶ڱ׼涨ķΧڹĹҲƵġ -磬ԣϵͳȥѧҪѧϰ֮صĺ֪ܶʶ㣬׵顣 -зdz໥ϸС֪ʶ㡣 - -ġڡ -ҷ֣ڱڽдҲ׵¡ڴͳҪһ¹ -·ǺѵġھʱʵѧϰǰǵĴ룬ǰ˻ -ĴĻϽ޸ơ -ֻеҲΪ֮֡󣬲ڽ뵽һȫµ֮лд diff --git a/exercises/1901100064/d12/main.py b/exercises/1901100064/d12/main.py deleted file mode 100644 index c4fa351a0..000000000 --- a/exercises/1901100064/d12/main.py +++ /dev/null @@ -1,52 +0,0 @@ -from mymodule import stats_word -import logging -import jieba -import requests -import pyquery -from wxpy import * - - -logging.basicConfig(format='file:%(filename)s | line:%(lineno)d | message:%(message)s',\ - level=logging.DEBUG) - - -# 定义提取微信公众号正文的函数 -def get_article(): - r = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - print(r) - t =r.text - #print(t) - d = pyquery.PyQuery(t) - #print(d) - article = d('#js_content').text() - print(article ) - return article - - - - -def main(): - # 导入模块 - # 初始化机器人,扫码登陆 - bot = Bot() - friends = bot.friends() - - @bot.register(friends,SHARING) - def handler(msg): - try: - logging.info('sharing url = %s',msg.url) - article=get_article(msg.url) - result = stats_word.stats_text_cn(article,10) - msg.reply(str(result)) - except Exception as e: - #抛出错误 - logging.exception(e) - - # 进入 Python 命令行、让程序保持运行 - embed() - - -if __name__ == "__main__": - main() - - diff --git a/exercises/1901100064/d12/mymodule/stats_word.py b/exercises/1901100064/d12/mymodule/stats_word.py deleted file mode 100644 index 080472871..000000000 --- a/exercises/1901100064/d12/mymodule/stats_word.py +++ /dev/null @@ -1,108 +0,0 @@ -from collections import Counter -import jieba - -# 统计英文单词数量 -def stats_text_en(text,count): - - ''' - # 验证输入的数据是否是字符串类型 - if not isinstance(text,str): - raise ValueError('参数必须是str类型,输入类型%s'%type(text)) - ''' - - elements = text.split () - words = [] - symbols = ',.*-!"?' - - for element in elements: - for symbol in symbols: - element = element.replace ( symbol, '' ) - if len ( element ) and element.isascii (): - words.append ( element ) - - return Counter(words).most_common(count) - - -################################################################################### -# 统计中文汉字数量 - -def stats_text_cn(text,count): - - ''' - # 验证输入的数据是否是字符串类型 - if not isinstance(text,str): - raise ValueError('参数必须是str类型,输入类型%s'%type(text)) - ''' - - words = jieba.cut(text) # 存在一个隐患:没有事先把英文字符排除 - tmp = [] - for i in words: - if len(i)>1: - tmp.append ( i ) - - return Counter( tmp ).most_common(count) - - -########################################################################################## - -en_text = '''The Zen of Python , by Tim Peters - Beautiful is better than ugly. - Explicit is better than implicit. - Simple is better than complex. - Complex is better than complicated. - Flat is better than nested. - Sparse is better than dense. - Readability counts. - Special cases aren't special enough to break the rules. - Although practicality beats purity. Errors should never pass silently. - Unless explicitly silenced. In the face of ambxiguity, refuse the temptation to guess. - There should be one-- and preferably only one --obvious way to do it. - Although that way may not be obvious at first unless you're Dutch. - Now is better than never. Although never is often better than *right* now. - If the implementation is hard to explain, it's a bad idea. - If the implementation is easy to explain, it may be a good idea. - Namespaces are one honking great idea -- let's do more of those! - ''' - -cn_text = ''' -python 之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -即便假借特例的实用性之名,也不可违背这些规则 -不要包容所有错误,除非你确定需要这样做 -当存在多种可能时,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决的方案 -虽然这并不容易,因为你不是python之父 -做也许好过不做,但不假思索就动手还不如不做 -,,,, -。。。。 - - -''' - -if __name__ == '__main__': - en_result = stats_text_en ( en_text,10 ) - cn_result = stats_text_cn ( cn_text,10 ) - print ( '统计参数中每个英文单词出现的次数==》\n', en_result ) - print ( '统计参数中每个中文单词出现的次数==》\n', cn_result ) - - -########################################################################################## - -# 添加一个名为stats_text()的函数 - -def stats_text(text,count): - - # 验证输入的数据是否是字符串类型 - if not isinstance(text,str): - raise ValueError('参数必须是str类型,输入类型%s'%type(text)) - - ''' - 合并中英文统计结果 - ''' - return stats_text_en ( text,count ) + stats_text_cn ( text,count ) diff --git a/exercises/1901100064/d13/main.py b/exercises/1901100064/d13/main.py deleted file mode 100644 index c74f37761..000000000 --- a/exercises/1901100064/d13/main.py +++ /dev/null @@ -1,108 +0,0 @@ -print('hello world') - -from mymodule import stats_word -import logging -import jieba -import requests -import pyquery -from wxpy import * -import numpy -import matplotlib.pyplot as plt -from os import path - - -# 获取当前工作目录 -cwd = path.abspath(path.dirname(__file__)) -print(cwd) -# image_path=path.join(cwd,'stats.png') - - -# 定义提取微信公众号正文的函数 -def get_article(url): - r = requests.get(url) - print(r) - t =r.text - #print(t) - d = pyquery.PyQuery(t) - #print(d) - article = d('#js_content').text() - # print(article ) - return article - - - - -def generate_image(data,image_path): - labels = [i[0] for i in data] - height = [i[1] for i in data] - - ypos = range(len(data)) - print(ypos) - - - plt.rcdefaults() - fig,ax = plt.subplots() - - # 设置中文字体 - plt.rcParams['font.sans-serif']='SimHei' - plt.rcParams["axes.unicode_minus"]=False - - # 设置坐标轴的样式 ax - ax.barh(ypos,height) - ax.set_yticks(ypos) - ax.set_yticklabels(labels) - ax.invert_yaxis() - ax.set_ylabel('关键字') - ax.set_xlabel('词频') - ax.set_title('统计词频') - - # 打印当前工作目录 - print(cwd) - # 将图片保存在当前工作目录下的stats.png文件 - print(image_path) - fig.savefig(image_path,bbox_inches='tight') - - #plt.show() - - -# 定义测试程序 -def test(): - article=get_article('https://mp.weixin.qq.com/s?__biz=MzIzMjIxNTc5Nw==&mid=2247517818&idx=6&sn=40ed31d7bcc5ec8c5a444952717cac5e&chksm=e89a83e0dfed0af6daf09a991d546285d2316fa65fcc0bd36e2d300fbf20a51c8064f9cfa740&mpshare=1&scene=23&srcid=0916IRTHO2F9mJnLhcQc2hb9&sharer_sharetime=1568611270839&sharer_shareid=ce38eb1d8a5991abab91df065c7e5d64#rd') - result = stats_word.stats_text_cn(article,20) - image_path=path.join(cwd,'stats.png') - generate_image(result,image_path) - - -# 定义主程序 -def main(): - # 导入模块 - # 初始化机器人,扫码登陆 - bot = Bot() - friends = bot.friends() - - @bot.register(friends,SHARING) - def handler(msg): - try: - logging.info('sharing url = %s',msg.url) - - #调用自定义函数get_article() - article=get_article(msg.url) - #调用from mymodule import stats_word - result = stats_word.stats_text_cn(article,20) - - #调用自定义函数generate_image() - image_path=path.join(cwd,'stats.jpg') - generate_image(result,image_path) - - msg.reply_image(image_path) - except Exception as e: - #抛出错误 - logging.exception(e) - - # 进入 Python 命令行、让程序保持运行 - embed() - - -if __name__ == "__main__": - #test() - main() \ No newline at end of file diff --git a/exercises/1901100064/d13/mymodule/stats_word.py b/exercises/1901100064/d13/mymodule/stats_word.py deleted file mode 100644 index 080472871..000000000 --- a/exercises/1901100064/d13/mymodule/stats_word.py +++ /dev/null @@ -1,108 +0,0 @@ -from collections import Counter -import jieba - -# 统计英文单词数量 -def stats_text_en(text,count): - - ''' - # 验证输入的数据是否是字符串类型 - if not isinstance(text,str): - raise ValueError('参数必须是str类型,输入类型%s'%type(text)) - ''' - - elements = text.split () - words = [] - symbols = ',.*-!"?' - - for element in elements: - for symbol in symbols: - element = element.replace ( symbol, '' ) - if len ( element ) and element.isascii (): - words.append ( element ) - - return Counter(words).most_common(count) - - -################################################################################### -# 统计中文汉字数量 - -def stats_text_cn(text,count): - - ''' - # 验证输入的数据是否是字符串类型 - if not isinstance(text,str): - raise ValueError('参数必须是str类型,输入类型%s'%type(text)) - ''' - - words = jieba.cut(text) # 存在一个隐患:没有事先把英文字符排除 - tmp = [] - for i in words: - if len(i)>1: - tmp.append ( i ) - - return Counter( tmp ).most_common(count) - - -########################################################################################## - -en_text = '''The Zen of Python , by Tim Peters - Beautiful is better than ugly. - Explicit is better than implicit. - Simple is better than complex. - Complex is better than complicated. - Flat is better than nested. - Sparse is better than dense. - Readability counts. - Special cases aren't special enough to break the rules. - Although practicality beats purity. Errors should never pass silently. - Unless explicitly silenced. In the face of ambxiguity, refuse the temptation to guess. - There should be one-- and preferably only one --obvious way to do it. - Although that way may not be obvious at first unless you're Dutch. - Now is better than never. Although never is often better than *right* now. - If the implementation is hard to explain, it's a bad idea. - If the implementation is easy to explain, it may be a good idea. - Namespaces are one honking great idea -- let's do more of those! - ''' - -cn_text = ''' -python 之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -即便假借特例的实用性之名,也不可违背这些规则 -不要包容所有错误,除非你确定需要这样做 -当存在多种可能时,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决的方案 -虽然这并不容易,因为你不是python之父 -做也许好过不做,但不假思索就动手还不如不做 -,,,, -。。。。 - - -''' - -if __name__ == '__main__': - en_result = stats_text_en ( en_text,10 ) - cn_result = stats_text_cn ( cn_text,10 ) - print ( '统计参数中每个英文单词出现的次数==》\n', en_result ) - print ( '统计参数中每个中文单词出现的次数==》\n', cn_result ) - - -########################################################################################## - -# 添加一个名为stats_text()的函数 - -def stats_text(text,count): - - # 验证输入的数据是否是字符串类型 - if not isinstance(text,str): - raise ValueError('参数必须是str类型,输入类型%s'%type(text)) - - ''' - 合并中英文统计结果 - ''' - return stats_text_en ( text,count ) + stats_text_cn ( text,count ) diff --git a/exercises/1901100078/d08/main.py b/exercises/1901100078/d08/main.py index 7aabaa5d5..3557d43c7 100644 --- a/exercises/1901100078/d08/main.py +++ b/exercises/1901100078/d08/main.py @@ -1,21 +1,9 @@ text = 123 from mymodule import stats_word -import traceback -import logging -logger = logging.getLogger(__name__) - try: print('中英文字频====>', stats_word.stats_text(text)) -except ValueError as err: - print("print out the error: ", err) - print(traceback.format_exc()) +except ValueError: + print("print out the error: ",ValueError) -def test_logger(): - try: - stats_word.stats_text(1) - except Exception as e: - logger.exception(e) -if __name__ == '__main__': - test_logger() diff --git a/exercises/1901100078/d08/mymodule/stats_word.py b/exercises/1901100078/d08/mymodule/stats_word.py index 16a6dfb2f..5063b42fd 100644 --- a/exercises/1901100078/d08/mymodule/stats_word.py +++ b/exercises/1901100078/d08/mymodule/stats_word.py @@ -19,7 +19,7 @@ def stats_text_en(text): def stats_text_cn(text): '''统计中文字频''' if not isinstance(text, str): - raise ValueError('Sould be str type, input %s'%type(text)) + raise ValueError List = [i for i in text] word_dict = {} for word in set(List): @@ -30,7 +30,7 @@ def stats_text_cn(text): def stats_text(text): "统计文本中出现的英文以及中文字符频率" if not isinstance(text, str): - raise ValueError('not str type, input tyoe is %s'%type(text)) + raise ValueError cn_str = '' en_str = '' for char in text: diff --git a/exercises/1901100078/d09/main.py b/exercises/1901100078/d09/main.py deleted file mode 100644 index 917224811..000000000 --- a/exercises/1901100078/d09/main.py +++ /dev/null @@ -1,23 +0,0 @@ -with open ('tang300.json') as f: - text = f.read() - - -from mymodule import stats_word -import traceback -import logging -logger = logging.getLogger(__name__) - -try: - print('中文字频====>', stats_word.stats_text_cn(text, 100)) -except ValueError as err: - print("print out the error: ", err) - print(traceback.format_exc()) - -'''def test_logger(): - try: - stats_word.stats_text(1) - except Exception as e: - logger.exception(e) - -if __name__ == '__main__': - test_logger()''' diff --git a/exercises/1901100078/d09/mymodule/stats_word.py b/exercises/1901100078/d09/mymodule/stats_word.py deleted file mode 100644 index 3b909a36a..000000000 --- a/exercises/1901100078/d09/mymodule/stats_word.py +++ /dev/null @@ -1,43 +0,0 @@ -from collections import Counter - -def stats_text_en(text, count): - ''' count the word in the text ''' - if not isinstance(text, str): - raise ValueError('参数必须是str类型,输入类型%s' %type(text)) - words_list = text.split() - no_pun_list = [] - for word in words_list: - word = word.strip('.!--*') - if word.isalpha(): - no_pun_list.append(word) - - words_seq = Counter(no_pun_list).most_common(count) - return words_seq - - -def stats_text_cn(text, count): - '''统计中文字频''' - if not isinstance(text, str): - raise ValueError('Sould be str type, input %s'%type(text)) - cn_characters = [] - for character in text: - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - - cn_seq = Counter(cn_characters).most_common(count) - return cn_seq - -def stats_text(text, count): - "统计文本中出现的英文以及中文字符频率" - if not isinstance(text, str): - raise ValueError('not str type, input tyoe is %s'%type(text)) - - return stats_text_en(text, count) + stats_text_cn(text, count) - - -if __name__ == '__main__': - text = '''learn python is very funny, 但是没想象中那么轻松。''' - print(stats_text(text,100)) - - - \ No newline at end of file diff --git a/exercises/1901100081/d11/main.py b/exercises/1901100081/d11/main.py deleted file mode 100644 index fe3ddb653..000000000 --- a/exercises/1901100081/d11/main.py +++ /dev/null @@ -1,32 +0,0 @@ -import getpass -sender = input('输⼊发件⼈邮箱:') -password = getpass.getpass('输⼊发件⼈邮箱密码(可复制粘贴):') -recipients = input('输⼊收件⼈邮箱:') - -from mymodule import stats_word - -import requests -r = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA',auth = ('user','pass')) -# print(r) -r.status_code -# 提取微信公众号正⽂伪代码示例 -from pyquery import PyQuery -document = PyQuery(r.text) -content = document('#js_content').text() -# print(content) - -x = stats_word.stats_text_cn(content) -# s = " ".join (x) -values = ','.join(str(v) for v in x) -print (values) - -import yagmail -# yag = yagmail.SMTP(sender,password,'yaowenxin0915@gmail.com') 1311557847@qq.com pythoncamp@163.com -# 这个要用对应邮箱的服务器后缀,我猜gmail或许是这个? -# yag = yagmail.SMTP(sender,password,'smtp.gmail.com') -yag = yagmail.SMTP(sender,password,'smtp.qq.com') - -to = recipients # 上面有收件人的 -subject = '【1901100081】⾃学训练营学习15群 DAY11 yaodadada' -body = values -yag.send(to = to,subject = subject, contents = body ) \ No newline at end of file diff --git a/exercises/1901100081/d11/mymodule/stats_word.py b/exercises/1901100081/d11/mymodule/stats_word.py deleted file mode 100644 index 2f8812058..000000000 --- a/exercises/1901100081/d11/mymodule/stats_word.py +++ /dev/null @@ -1,94 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -# 统计参数中每个英文单词出现的次数,最后返回一个按词频词频降序排列的数组 -def stats_text_en(t,co=100): - # if type(t)!=str: - # raise ValueError('非字符串类型') - # 统计次数 - l1=t.split() - l2=[] - sy='-*, .''!\n\t:' - for l3 in l1: - for sy1 in sy: - l3 = l3.replace(sy1,'') - # 用str 类型的isascii 方法判断是否是英文单词 - if len (l3) and l3.isascii(): - l2.append(l3) - # 排序 - from collections import Counter - cnt = Counter() - for word in l2: - cnt[word] += 1 - return (cnt.most_common(co)) - -# 统计汉字 -def stats_text_cn(t,co = 100): - if type(t)!=str: - raise ValueError('非字符串类型') - c=[] - sy='“”-,。. ‘’!?:」「' - for c2 in t: - for sy2 in sy: - c2=c2.replace(sy2,'') - if '\u4e00'<=c2<='\u9fff': - c.append(c2) - str1=''.join(c) - import jieba - seg_list = jieba.cut(str1,cut_all=False) - # print("defauil mode:"+"/".join(seg_list)) - from collections import Counter - # cnt = Counter() - c3=[] - for word in seg_list: - # cnt[word] += 1 - if len(word)>1: - c3.append(word) - # for word in c: - # cnt[word] += 1 - return (Counter(c3).most_common(co)) - - # counter ={} - # set2=set(c) - # for c2 in set2: - # counter[c2]=c.count(c2) - - # return sorted(counter.items(),key=lambda x:x[1],reverse=True) - -# 汉字和英文 -def stats_text(text): - if type(text)!=str: - raise ValueError('非字符串类型') - return stats_text_cn(text) + stats_text_en(text) - -# 测试 - -cn='照猫画虎,照葫芦画瓢。这里应该有一个长文本,但是我也不知道该写一个什么样的长文本,就打算写个流水账先试一试。' -if __name__ =='__main__': #测试时候为了防止被调用 - e=stats_text_en(text) - cx =stats_text_cn(cn) - print (e) - print (cx) - -# q 为什么还是会把标点符号算进去呢 -# a 把英文','换成中文‘,’就可以了 - diff --git a/exercises/1901100085/1001S02E04_control_flow.py b/exercises/1901100085/1001S02E04_control_flow.py deleted file mode 100644 index 23a69e22f..000000000 --- a/exercises/1901100085/1001S02E04_control_flow.py +++ /dev/null @@ -1,17 +0,0 @@ -print('打印九九乘法表') -for i in range(1,10): - for j in range(1,i + 1): - print(i,"*",j,"=",i * j,end='\t') - print() - - -print('\n打印跳过偶数行的九九乘法表') -i = 1 -while i < 10: - if i % 2 == 0: - print() - else: - for j in range(1,i + 1): - print(i,'*',j,'=',i * j,end='\t') - i += 1 - \ No newline at end of file diff --git a/exercises/1901100092/README.md b/exercises/1901100092/README.md index 932bbe9c5..e69de29bb 100644 --- a/exercises/1901100092/README.md +++ b/exercises/1901100092/README.md @@ -1 +0,0 @@ -ҴѧϰЧ͵ѧԱɣ14ĿγӲı²ɡǰѧϰʹGitHubЭñпʽӴ̣ǵÿõһͷˮ֪֣һʼѽ̳̻ӦһҪþõʱܰڼDzϣԼԶǸֻӱѵˡѧϰĹ̲Ǻɣгɹijɾ͸кҶһڴεļִǰ;ϵļ¼ڳɳ·ϣϣԼܹһֱȥ \ No newline at end of file diff --git a/exercises/1901100092/d11/main.py b/exercises/1901100092/d11/main.py deleted file mode 100644 index 68078d0f8..000000000 --- a/exercises/1901100092/d11/main.py +++ /dev/null @@ -1,27 +0,0 @@ -from mymodule import stats_word -from pyquery import PyQuery -import requests -import getpass -import yagmail - -def load_file(): - - response = requests.get(url = 'https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - - document = PyQuery(response.text) - content = document('#js_content').text() - return content - -#text=1 #验证参数检查功能是否生效 -try: - i = stats_word.stats_text_cn(load_file()) - print(i) -except ValueError: - print('stats_text参数应为字符串类型') - -sender = input('输入发件人邮箱:') -password_1 = getpass.getpass('输入发件人邮箱密码:') -recipients = input('输入收件人邮箱:') - -yag = yagmail.SMTP(user = sender,password = password_1,host = 'smtp.qq.com') -yag.send(to = recipients,subject = "【1901100092】自学训练营学习15群DAY11 Yui",contents = str(i)) diff --git a/exercises/1901100092/d11/mymodule/stats_word.py b/exercises/1901100092/d11/mymodule/stats_word.py deleted file mode 100644 index 79ce8bc9f..000000000 --- a/exercises/1901100092/d11/mymodule/stats_word.py +++ /dev/null @@ -1,90 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! - -美丽总比丑陋好 -显式比隐式好 -简单总比复杂好 -复杂总比复杂好 -平的比嵌套的好 -稀疏总比密集好 -可读性 -特殊情况还不足以打破规则 -虽然实用性胜过纯洁性 -错误不应该悄无声息地过去 -除非显式地沉默 -面对敏锐,拒绝猜测的诱惑 -应该有一种——而且最好只有一种——显而易见的方法来做到这一点 -不过,除非你是荷兰人,否则这种方式一开始可能并不明显 -现在总比不做好 -虽然从来没有比“现在”更好 -如果实现很难解释,这是一个坏主意 -如果实现很容易解释,这可能是一个好主意 -名称空间是一个很棒的主意——让我们做更多这样的事情 -''' -import jieba -import collections - - -def stats_text_en(text): - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - elements=text.split() #整理字符 - words=[] #建立列表 - symbols=',.*-!' - for element in elements: - for symbol in symbols: - element=element.replace(symbol,'') #清理符号 - if len(element) and element.isascii(): - words.append(element) #将字符加入words列表 - - l_en = collections.Counter(words).most_common(100) - return l_en - -def stats_text_cn(text): - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - seg_list = jieba.cut(text,cut_all=False) - - cn_characters = [] #建立一个空列表,为下一个循环使用 - for i in seg_list: - if '\u4e00' <= i <= '\u9fff' and len(i) >= 2: - cn_characters.append(i) - - l_en_cn = collections.Counter(cn_characters).most_common(100) - return l_en_cn - - - -def stats_text(text): - '''输出合并词频统计结果''' - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - return stats_text_en(text) + stats_text_cn(text) - -if __name__ =='__main__': - print(stats_text(text)) - - - diff --git a/exercises/1901100092/d12/main.py b/exercises/1901100092/d12/main.py deleted file mode 100644 index 503b1f766..000000000 --- a/exercises/1901100092/d12/main.py +++ /dev/null @@ -1,17 +0,0 @@ -from mymodule import stats_word -from pyquery import PyQuery -import requests -import getpass -from wxpy import * - -bot = Bot(cache_path = True) -friend = bot.friends() -@bot.register(friend,SHARING) -def load_file(msg): - response = requests.get(url = msg.url) - - document = PyQuery(response.text) - content = document('#js_content').text() - i = str(stats_word.stats_text_cn(content)) - msg.reply(i) -embed() \ No newline at end of file diff --git a/exercises/1901100092/d12/mymodule/stats_word.py b/exercises/1901100092/d12/mymodule/stats_word.py deleted file mode 100644 index 79ce8bc9f..000000000 --- a/exercises/1901100092/d12/mymodule/stats_word.py +++ /dev/null @@ -1,90 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! - -美丽总比丑陋好 -显式比隐式好 -简单总比复杂好 -复杂总比复杂好 -平的比嵌套的好 -稀疏总比密集好 -可读性 -特殊情况还不足以打破规则 -虽然实用性胜过纯洁性 -错误不应该悄无声息地过去 -除非显式地沉默 -面对敏锐,拒绝猜测的诱惑 -应该有一种——而且最好只有一种——显而易见的方法来做到这一点 -不过,除非你是荷兰人,否则这种方式一开始可能并不明显 -现在总比不做好 -虽然从来没有比“现在”更好 -如果实现很难解释,这是一个坏主意 -如果实现很容易解释,这可能是一个好主意 -名称空间是一个很棒的主意——让我们做更多这样的事情 -''' -import jieba -import collections - - -def stats_text_en(text): - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - elements=text.split() #整理字符 - words=[] #建立列表 - symbols=',.*-!' - for element in elements: - for symbol in symbols: - element=element.replace(symbol,'') #清理符号 - if len(element) and element.isascii(): - words.append(element) #将字符加入words列表 - - l_en = collections.Counter(words).most_common(100) - return l_en - -def stats_text_cn(text): - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - seg_list = jieba.cut(text,cut_all=False) - - cn_characters = [] #建立一个空列表,为下一个循环使用 - for i in seg_list: - if '\u4e00' <= i <= '\u9fff' and len(i) >= 2: - cn_characters.append(i) - - l_en_cn = collections.Counter(cn_characters).most_common(100) - return l_en_cn - - - -def stats_text(text): - '''输出合并词频统计结果''' - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - return stats_text_en(text) + stats_text_cn(text) - -if __name__ =='__main__': - print(stats_text(text)) - - - diff --git a/exercises/1901100092/d13/main.py b/exercises/1901100092/d13/main.py deleted file mode 100644 index 878dfb1ac..000000000 --- a/exercises/1901100092/d13/main.py +++ /dev/null @@ -1,47 +0,0 @@ -from mymodule import stats_word -from pyquery import PyQuery -import requests -import getpass -from wxpy import * -import matplotlib.pyplot as plt -import numpy as np - -bot = Bot(cache_path = True) -friend = bot.friends() -@bot.register(friend,SHARING) -def load_file(msg): - response = requests.get(url = msg.url) - - document = PyQuery(response.text) - content = document('#js_content').text() - i = str(stats_word.stats_text_cn(content)) - - plt.rcdefaults() - figure, ax = plt.subplots() - - plt.rcParams['font.sans-serif'] = ['SimHei'] - - dict_i = dict(i) - x_values = [] - y_values = [] - for k,v in dict_i.items(): - x_values.append(k) - y_values.append(v) - y_pos = np.arange(len(x_values)) - error = np.random.rand(len(x_values)) - - ax.barh(y_pos, y_values, xerr=error, align='center') - ax.set_yticks(y_pos) - ax.set_yticklabels(x_values) - ax.invert_yaxis() - ax.set_xlabel("汉字") - ax.set_ylabel("出现次数") - ax.set_title("词频统计图") - plt.savefig("词频统计图.png") - - msg.reply_image("词频统计图.png") - -embed() - - - diff --git a/exercises/1901100092/d13/mymodule/stats_word.py b/exercises/1901100092/d13/mymodule/stats_word.py deleted file mode 100644 index 79ce8bc9f..000000000 --- a/exercises/1901100092/d13/mymodule/stats_word.py +++ /dev/null @@ -1,90 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! - -美丽总比丑陋好 -显式比隐式好 -简单总比复杂好 -复杂总比复杂好 -平的比嵌套的好 -稀疏总比密集好 -可读性 -特殊情况还不足以打破规则 -虽然实用性胜过纯洁性 -错误不应该悄无声息地过去 -除非显式地沉默 -面对敏锐,拒绝猜测的诱惑 -应该有一种——而且最好只有一种——显而易见的方法来做到这一点 -不过,除非你是荷兰人,否则这种方式一开始可能并不明显 -现在总比不做好 -虽然从来没有比“现在”更好 -如果实现很难解释,这是一个坏主意 -如果实现很容易解释,这可能是一个好主意 -名称空间是一个很棒的主意——让我们做更多这样的事情 -''' -import jieba -import collections - - -def stats_text_en(text): - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - elements=text.split() #整理字符 - words=[] #建立列表 - symbols=',.*-!' - for element in elements: - for symbol in symbols: - element=element.replace(symbol,'') #清理符号 - if len(element) and element.isascii(): - words.append(element) #将字符加入words列表 - - l_en = collections.Counter(words).most_common(100) - return l_en - -def stats_text_cn(text): - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - seg_list = jieba.cut(text,cut_all=False) - - cn_characters = [] #建立一个空列表,为下一个循环使用 - for i in seg_list: - if '\u4e00' <= i <= '\u9fff' and len(i) >= 2: - cn_characters.append(i) - - l_en_cn = collections.Counter(cn_characters).most_common(100) - return l_en_cn - - - -def stats_text(text): - '''输出合并词频统计结果''' - if not isinstance(text,str): - raise ValueError('参数应为字符串类型') - - return stats_text_en(text) + stats_text_cn(text) - -if __name__ =='__main__': - print(stats_text(text)) - - - diff --git a/exercises/1901100097/1001S02E01_helloworld.txt b/exercises/1901100097/1001S02E01_helloworld.txt deleted file mode 100644 index adaa78b21..000000000 --- a/exercises/1901100097/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -happy \ No newline at end of file diff --git a/exercises/1901100097/1001S02E02_hello_python.py b/exercises/1901100097/1001S02E02_hello_python.py deleted file mode 100644 index 10cdd20ed..000000000 --- a/exercises/1901100097/1001S02E02_hello_python.py +++ /dev/null @@ -1,2 +0,0 @@ -msg="hello world" -print(msg) diff --git a/exercises/1901100097/1001S02E03_calculator.py b/exercises/1901100097/1001S02E03_calculator.py deleted file mode 100644 index d2f183f56..000000000 --- a/exercises/1901100097/1001S02E03_calculator.py +++ /dev/null @@ -1,23 +0,0 @@ -operator=input('请输入运算符(+、-、*、/):') -first_number=input('请输入第一个数字:') -second_number=input('请输入第二个数字:') - -a=int(first_number) -b=int(second_number) - -print('operator:',operator,type(operator)) -print('first_number:',first_number,type(first_number),type(a)) -print('second_number:',second_number,type(second_number),type(b)) - -print('测试加法str加法:',first_number+second_number) - -if operator=='+': - print(a,'+',b,'=',a+b) -elif operator=='-': - print(a,'-',b,'=',a-b) -elif operator=='*': - print(a,'*',b,'=',a*b) -elif operator=='/': - print(a,'/',b,'=',a/b) -else: - print('无效的运算符') diff --git a/exercises/1901100097/README.md b/exercises/1901100097/README.md deleted file mode 100644 index 64ea7df7c..000000000 --- a/exercises/1901100097/README.md +++ /dev/null @@ -1 +0,0 @@ -# learn Markdown \ No newline at end of file diff --git a/exercises/1901100100/README.md b/exercises/1901100100/README.md index f5576b2ac..6b3fb291e 100644 --- a/exercises/1901100100/README.md +++ b/exercises/1901100100/README.md @@ -1,26 +1,9 @@ -#### ǰ -˵ʵ2000ԪμҪѧpython̰࣬ʵҳһʱ䡣Ӧ˵712ѧһƪİǴҵģקСһѧϰҲǶ֮һ -#### ѧѵӪĽѧʽ -ҳΪѧѵӪ16ȺijԱڶннͨΪʲô΢?һʱ֣Ǹʺڹ罻ߡÿνڶȺиѧԱдɡѧԱѧϰ̰ҵÿεҵϽѧƵֱӰƵĿǾ͸ѧκζÿζҵȥƵʲôͬĵطʲôԽĵطγ̵ֽѧѵӪ˼ǽѧʾѧϰѰҷ⣬ҪѵѧʱѶ˼ֱҽкüأҿסijֹȸͰٶȶ޷ѣҽз -#### 2ѧľ弼 -1. gitubվϵͳԼʹãѧgitubϽп¡ύϲѯ𰸣 -2. ѧpythonvscodeʹã⻹notebook -3. ˽GBKuft-8룻 -4. ֪jsonʲôļͣԼһЩcollections.Counter().most_common(list) -5. ⣬jieba -6. pythonץȡҳݣʹyagmail -7. ΢ŻˣϢϢϢϧday13ĹûпʼһֱѶҳ΢Ÿˣ -8. ʹmatplotlib⻭򵥵Ķά״ͼʹnumpyĹܣѧƵûУΪУѧϰʹˣ -#### ûѧģҪŬģ -1. ʽ -2. װûУЩҳܣû͸) -3. ࣻ -4. ̵Ĺ淶 -濴ȫûеѧpython̵ӣҪ˵װʹ÷dz㷺࣬ѧĹУûи㶮 -#### ۺܽ? -ѧи֤Ԥԣ˵ԤԼʲôĻᷢ˵ûѧκмֵĶҾûѧκмֵ֪ʶȻûȻˣȻҲpythonˡ˵ѧ˶ʲôأ -һDzʲô϶Ĵ𰸣ҪѧȥѰҡ˹ȸͰٶȣͼݡͼݿһԽ賬15飬ʲô⣬ֻҪʣҾȥͼݱһ -ڶͨϰҵ˲ǰ֪pythonϣֿӡΪԺѧϰʹpythonЩ㡣 -#### -ΣҪʹpythonɹе⣬ѧѵӪջֻͣĿǰ״ѧûдﵽĿġ +# firstday +13սҷ˵һҵƵ˵ʵƵС޷ֻҲҸո⣬how to ask question the smart way"Լȸ涤ļԣرӰС⡣Ȼÿ˶Ҫ⣬ٻӰ飬лʱڱϣǺܺá +15գƵָѧgithubϽвmasterdevelop֧ڰװGitHubɡ + +16ϣ¼githubװgithub򣬰װ̺˳չҪļpull requestȵȶ˳ +ǵcloneֿ⵽صʱ鷳ˡ֪Ϊʲôcloneٶֻ14kb2-4kbҼǹ˿500M17磬һӿٶȣhttps://blog.csdn.net/w958660278/article/details/81161224 +17Ͻãwin10ϵͳĬϲϵͳԱȨޣ޷hostsļոհװwin10ͥϵͳɶıȶǴĵļͥ湦ܻвǷȱûûáһʱ𰸣ҵνһadministrator˺ţhostsļˢvdn +ʱ򣬿¡ֿٶȿ˺ܶ࣬ûжþؽȻڱ½ļsubsummit. pull request day1 ҵ \ No newline at end of file diff --git a/exercises/1901100100/d13/mymodule/main.py b/exercises/1901100100/d13/mymodule/main.py deleted file mode 100644 index ec94d94bf..000000000 --- a/exercises/1901100100/d13/mymodule/main.py +++ /dev/null @@ -1,47 +0,0 @@ -import requests -from pyquery import PyQuery as pq -import getpass -import stats_word -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.font_manager import * - - -myfont = FontProperties(fname='C:\Windows\Fonts\msyh.ttc') #make the font of chinese 雅黑 -#get the information of the web -url = 'https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA' -r = requests.get(url) -#get all the content of the web -document = pq(r.text) -content = document('#js_content').text() -#get the useful text by the pyquery way -#print(content) - -try: - dict1_order = stats_word.stats_text_cn(content,100) - #get the order of the 100th number - word_ar = np.array(dict1_order) - #print(word_ar) - word = word_ar[:,0] #取统计集合的汉语词组作为一个列表 - index = word_ar[:,1] #去统计集合中的词组出现次数作为列表 - print(word) - print(index) - #index = [float(i) for i in index] - index = index.astype(float) #将次数转换成浮点数 - y_pos = np.arange(len(word)) - plt.rcdefaults() - fig,ax = plt.subplots(figsize=(10, len(index) * 0.8)) - ax.barh(y_pos,index,height= 0.8) - ax.set_yticks(y_pos) - ax.set_yticklabels(word, fontproperties=myfont) - ax.invert_yaxis() - ax.set_xlabel('字数频度', fontproperties=myfont) - ax.set_title('index of the word') - fig.savefig('stats1.png') - plt.show() - -except ValueError as e: - print("the text needed to be sorted is not a string, please try again!\n ",e) - #this sentence is use to print the information of the exception - - diff --git a/exercises/1901100100/d13/mymodule/stats_word.py b/exercises/1901100100/d13/mymodule/stats_word.py deleted file mode 100644 index 0a20e0272..000000000 --- a/exercises/1901100100/d13/mymodule/stats_word.py +++ /dev/null @@ -1,58 +0,0 @@ -# This program is used to take english words or chinese words from a string. and make a -# statistics. display the result with a descending order -# -##################################### -# -*- coding: uft-8 -*- -from collections import Counter -import jieba -text = ''' -sender = 'suhunter@163.com' -password = 'redfox176wy' -recipients = 'suyy@gdg.com.cn' -愚公移⼭ -太⾏,王屋⼆⼭的北⾯,住了⼀個九⼗歲的⽼翁,名叫愚公。⼆⼭佔地廣闊,擋住去路,使他 -和家⼈往來極為不便。 -⼀天,愚公召集家⼈說:「讓我們各盡其⼒,剷平⼆⼭,開條道路,直通豫州,你們認為怎 -樣?」 -⼤家都異⼝同聲贊成,只有他的妻⼦表示懷疑,並說:「你連開鑿⼀個⼩丘的⼒量都沒有,怎 -可能剷平太⾏、王屋⼆⼭呢?況且,鑿出的⼟⽯⼜丟到哪裏去呢?」 -⼤家都熱烈地說:「把⼟⽯丟進渤海裏。」 -於是愚公就和兒孫,⼀起開挖⼟,把⼟⽯搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒⼦⼋歲也興致勃勃地⾛來幫忙。 -寒來暑往,他們要⼀年才能往返渤海⼀次。 -住在⿈河河畔的智叟,看⾒他們這樣⾟苦,取笑愚公說:「你不是很愚蠢嗎?你已⼀把年紀 -了,就是⽤盡你的氣⼒,也不能挖去⼭的⼀⻆呢?」 -愚公歎息道:「你有這樣的成⾒,是不會明⽩的。你⽐那寡婦的⼩兒⼦還不如呢!就算我死 -了,還有我的兒⼦,我的孫⼦,我的曾孫⼦,他們⼀直傳下去。⽽這⼆⼭是不會加⼤的,總有 -⼀天,我們會把它們剷平。」 -智叟聽了,無話可說: -⼆⼭的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤ -⼒神揹⾛⼆⼭。 -''' - - -def stats_text_cn(text,num): - # if text is not a string ,then raise a ValueError - if type(text) != str: - raise ValueError("you should give a string!") - # this is the function of statistic the chinese words which are more than two words - words_ch = jieba.cut(text) - words_list = [] - for word in words_ch: - if len(word) > 1: - words_list.append(word) - return Counter(words_list).most_common(num) - - - -if __name__ == '__main__': - result_all = stats_text_cn(text,15) - print(result_all) - # text_ch = stats_text_cn(text) - # print(text_ch) - - - - - - diff --git a/exercises/1901100100/day1.md b/exercises/1901100100/day1.md deleted file mode 100644 index 6b3fb291e..000000000 --- a/exercises/1901100100/day1.md +++ /dev/null @@ -1,9 +0,0 @@ -# firstday -13սҷ˵һҵƵ˵ʵƵС޷ֻҲҸո⣬how to ask question the smart way"Լȸ涤ļԣرӰС⡣Ȼÿ˶Ҫ⣬ٻӰ飬лʱڱϣǺܺá - -15գƵָѧgithubϽвmasterdevelop֧ڰװGitHubɡ - -16ϣ¼githubװgithub򣬰װ̺˳չҪļpull requestȵȶ˳ -ǵcloneֿ⵽صʱ鷳ˡ֪Ϊʲôcloneٶֻ14kb2-4kbҼǹ˿500M17磬һӿٶȣhttps://blog.csdn.net/w958660278/article/details/81161224 -17Ͻãwin10ϵͳĬϲϵͳԱȨޣ޷hostsļոհװwin10ͥϵͳɶıȶǴĵļͥ湦ܻвǷȱûûáһʱ𰸣ҵνһadministrator˺ţhostsļˢvdn -ʱ򣬿¡ֿٶȿ˺ܶ࣬ûжþؽȻڱ½ļsubsummit. pull request day1 ҵ \ No newline at end of file diff --git a/exercises/1901100132/d08/main.py b/exercises/1901100132/d08/main.py deleted file mode 100644 index 152c1b45a..000000000 --- a/exercises/1901100132/d08/main.py +++ /dev/null @@ -1,24 +0,0 @@ -from mymodule import stats_word -import traceback -import logging - -logger = logging.getLogger(__name__) - -def test_traceback(): - try: - stats_word.stats_text(1) - except Exception as e: - print('test_traceback =>', e) - print(traceback.format_exc()) - -def text_logger(): - try: - stats_word.stats_text(1) - except Exception as e: - #print('test_logger =>', e) - logger.exception(e) - -if __name__ == "__main__": - test_traceback() - text_logger() - diff --git a/exercises/1901100132/d08/mymodule/stats_word.py b/exercises/1901100132/d08/mymodule/stats_word.py deleted file mode 100644 index 655a81bce..000000000 --- a/exercises/1901100132/d08/mymodule/stats_word.py +++ /dev/null @@ -1,87 +0,0 @@ -# 统计参数中英文单词出现的次数 -def stats_text_en(text): - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - if len(element) and element.isascii(): - words.append(element) - counter = {} - word_set = set(words) - - for word in word_set: - counter[word] = words.count(word) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - -#统计参数中每个中文汉字出现的次数 -def stats_text_cn(text): - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - cn_characters = [] - for character in text: - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - counter = {} - cn_character_set = set(cn_characters) - for character in cn_character_set: - counter[character] = cn_characters.count(character) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - -en_text = ''' -The Zen of Python , by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implcit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases are't special enough to break the rules. -Although practicality beats purity. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one --- and preferably only one -- obvious way to do it. -Although the way may not be obvious at first unless you are a Dutch. -Now is better than never. -Although never is better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it's maybe a good idea. -Namespaces are one honking great idea --- let's do more of those! -''' - -cn_text = ''' -Python 之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简介胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -即便假借特例的实用性之名,也不可违背这些规则 -不要包含所有错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是Python 之父 -做也许好过不做,但不假思索就动手还不如不做 -''' - -def stats_text(text): - #合并英文词频和中文词频 - if not isinstance(text, str): - raise ValueError('参数必须是 str 类型, 输入类型 %s' % type(text)) - return stats_text_cn(text) + stats_text_en(text) - -if __name__ == '__main__': - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) - print('统计参数中每个英文单词出现的次数 ==>\n', en_result) - print('统计参数中每个中文汉字出现的次数 ==>\n', cn_result) - diff --git a/exercises/1901100134/1001S02E01_helloworld.txt b/exercises/1901100134/1001S02E01_helloworld.txt deleted file mode 100644 index 01c4a7aee..000000000 --- a/exercises/1901100134/1001S02E01_helloworld.txt +++ /dev/null @@ -1,8 +0,0 @@ -{\rtf1\ansi\ansicpg936\cocoartf1671\cocoasubrtf200 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\fs28 \cf0 Hello world} \ No newline at end of file diff --git a/exercises/1901100134/README.md b/exercises/1901100134/README.md deleted file mode 100644 index 87dc6f1fe..000000000 --- a/exercises/1901100134/README.md +++ /dev/null @@ -1,8 +0,0 @@ -{\rtf1\ansi\ansicpg936\cocoartf1671\cocoasubrtf200 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;;} -\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\fs36 \cf0 # Learn Markdown} \ No newline at end of file diff --git a/exercises/1901100140/1001S02E05_array.py b/exercises/1901100140/1001S02E05_array.py deleted file mode 100644 index 6ea94cce4..000000000 --- a/exercises/1901100140/1001S02E05_array.py +++ /dev/null @@ -1,26 +0,0 @@ -[0,1,2,3,4,5,6,7,8,9] -sample_list=[0,1,2,3,4,5,6,7,8,9] -reverse_list=sample_list[::-1] -print(reverse_list) - -#将翻转后的数组拼接成字符 -joined_str="".join(str(i) for i in reverse_list) -print(joined_str) - -#用字符切片的方式取出第三到第八个字符 -sliced_str=joined_str[2:8] -print(sliced_str) - -#将获得的字符串进行反转 -reverse_str=sliced_str[::-1] -print(reverse_str) - -#将结果转换为int类型 -int_value=int(reverse_str) -print(int_value) - -#分别转换成二进制、八进制、十六进制 -print(bin(int_value)) -print(oct(int_value)) -print(hex(int_value)) - diff --git a/exercises/1901100140/1001S02E05_stats_text.py b/exercises/1901100140/1001S02E05_stats_text.py deleted file mode 100644 index a7271e986..000000000 --- a/exercises/1901100140/1001S02E05_stats_text.py +++ /dev/null @@ -1,42 +0,0 @@ - -sample_text=""" -The zen of Python,by Tim peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity,refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain,it's a bad idea. -If the implementation is east to explain,it may be a good idea. -Namespaces are one honking great idea-- let's do more of those! -""" - -elements=sample_text.split() -words=[] -symbols=",.*-" -for element in elements: - for symbol in symbols: - element=element.replace("symbols","") - if len(element): - words.append(element) -print("打印正常的英文单词",words) - -# 统计单词出现的次数 -counter={} -word_set=set(words) -for word in word_set: - counter[word]=words.count(word) -print("统计单词出现的次数",counter) -#按照出现次数从大到小统计所有的单词及出现的次数 -print("按照出现次数从大到小统计所有的单词及出现的次数",sorted(counter.items(),key=lambda x:x[1],reverse=True)) diff --git a/exercises/1901100140/1001S02E05_string.py b/exercises/1901100140/1001S02E05_string.py deleted file mode 100644 index f9ea576d8..000000000 --- a/exercises/1901100140/1001S02E05_string.py +++ /dev/null @@ -1,38 +0,0 @@ - -sample_text=""" -The zen of Python,by Tim peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity,refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain,it's a bad idea. -If the implementation is east to explain,it may be a good idea. -Namespaces are one honking great idea-- let's do more of those! -""" -# 1 将字符串样本里的“better”全部替换成“worse” -text=sample_text.replace("better","worse") -print("将字符串样本text里的better全部替换成worse",text) - # 2 将单词中包含ea的单词剔除 -words=text.split() -filtered=[] -for word in words: - if word.find("ea")<0: - filtered.append(word) -print("将单词中包含ea的单词剔除",filtered) -#3 将单词中的字母进行大小写翻转 -swapcased=[i.swapcase()for i in filtered] -print("字母大小写翻转后的结果",swapcased) -#4 将所有单词按a-z升序排列 -print("将所有单词按z-a降序排列",sorted(swapcased)) diff --git a/exercises/1901100140/1010S02E03_calculator.py b/exercises/1901100140/1010S02E03_calculator.py index a81353434..b963d3cdd 100644 --- a/exercises/1901100140/1010S02E03_calculator.py +++ b/exercises/1901100140/1010S02E03_calculator.py @@ -16,4 +16,3 @@ print(a,"/",b,"=",a/b) else: print("无效的运算符") - diff --git a/exercises/1901100146/d13/main.py b/exercises/1901100146/d13/main.py deleted file mode 100644 index e2802113c..000000000 --- a/exercises/1901100146/d13/main.py +++ /dev/null @@ -1,66 +0,0 @@ -from os import path -import logging -import requests -import matplotlib.pyplot as plt -import pyquery -from wxpy import * -from mymodule import stats_word - -# 安装依赖包 wxpy -# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib - -# 获取当前工作目标 -cwd = path.abspath(path.dirname(__file__)) -plt.rcParams['font.sans=serif'] = 'SimHei' - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message: %(message)s', level=logging.DEBUG) - -# 提取公众号文章正文 -def get_article(url): - r = requests.get(url) - document = pyquery.PyQuery(r.text) - return document('#js_content').text() - -# 生成图片 -def generate_image(data, image_path): - labels = [v[0] for v in data] - widths = [v[1] for v in data] - ypos = range(len(data)) - fig, ax = plt.subplots() - ax.barh(ypos,widths) - ax.set_yticks(ypos) - ax.set_yticklabels(labels) - ax.invert_yaxis() - ax.set_ylabel('关键字') - ax.set_xlabel('词频') - ax.set_title('词频统计') - fig.savefig(image_path, bbox_inches='tight') - - -def main(): - bot = Bot() - friends = bot.friends() - - @bot.register(friends, SHARING) - def handler(msg): - try: - logging.info('sharing url = %s', msg.url) - article = get_article(msg.url) - result = stats_word.stats_text_cn(article,20) - image_path = path.join(cwd, 'stats.png') - generate_image(result, image_path) - msg.reply(str(result)) - except Exception as e: - logging.exception(e) - embed() - - -def test(): - article = get_article('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - result = stats_word.stats_text_cn(article,20) - image_path = path.join(cwd, 'stats.png') - generate_image(result,image_path) - -if __name__ == "__main__": - main() - #test() \ No newline at end of file diff --git a/exercises/1901100146/d13/mymodule/stats_word.py b/exercises/1901100146/d13/mymodule/stats_word.py deleted file mode 100644 index 8f5cd4e10..000000000 --- a/exercises/1901100146/d13/mymodule/stats_word.py +++ /dev/null @@ -1,38 +0,0 @@ -from collections import Counter -import jieba - -# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jieba - -# 统计参数中每个英文单词出现的次数 -def stats_text_en(text, count): - elements = text.split() - words=[] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text, count): - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i) > 1: - tmp.append(i) - return Counter(tmp).most_common(count) - - -def stats_text(text,count): - ''' - 合并 英文单词 和中文字频 的结果 - ''' - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text, count) + stats_text_cn(text, count) - - diff --git a/exercises/1901100148/1001S02E06_stats_word.py b/exercises/1901100148/1001S02E06_stats_word.py index f7e1f745f..96c9bc40d 100644 --- a/exercises/1901100148/1001S02E06_stats_word.py +++ b/exercises/1901100148/1001S02E06_stats_word.py @@ -34,18 +34,18 @@ def stats_text_en(text): # 统计参数中英文单词出现的次数,最 for element in elements: for symbol in symbols: element=element.replace(symbol,'') - if len(element):#单词长度是否大于0,大于0则为单词,否则是空格 + if len(element): words.append(element) # 初始化一个dict(字典)类型的变量,用来存放单词出现的次数 counter={} - word_set=set(words) #set集合里的元素是无序且不重复的。 - for word in word_set: # 遍历的时候也会减少遍历的次数 + word_set=set(words) + for word in word_set: counter[word]=words.count(word) - # 函数返回值用 return 进行返回,如果没有 return 返回值则为 None。 return sorted(counter.items(),key=lambda x:x[1],reverse=True) - +en_result=stats_text_en(en_text) +print(en_result) # 2.定义stats_text_cn 函数,接受一个字符串作为参数,统计参数中每个汉字出现的次数,最后返回一个按字频降序排列的数组 @@ -57,23 +57,15 @@ def stats_text_en(text): # 统计参数中英文单词出现的次数,最 而是因为我们越来越坚强。''' def stats_text_cn(text): - cn_characters = [] # characters字符 - for character in text: - # unicode 中 中文 字符的范围 - if'\u4e00'<=character<='\u9fff': - cn_characters.append(character) + item_cn=[] + for item in text: + if'\u4e00'<=item<='\u9fff': + item_cn.append(item) counter={} - cn_character_set=set(cn_characters) # 把中文字符列表转化成一个集合的形式,去除重复的字符 - for character in cn_character_set: # 遍历集合 - counter[character]=cn_characters.count(character)#统计中文列表里字符的次数,且赋值给字典对应的项,就是字符出现的次数 - return sorted(counter.items(),key=lambda x:x[1],reverse=True) #进行降序排序 - -#搜索__name__==__main__ -#一般情况下在文件内 测试 代码的时候以下面的形式进行 -if __name__=='__main__': - en_result=stats_text_en(en_text) - cn_result=stats_text_cn(cn_text) - print('统计参数中每个英文单词出现的次数-->\n',en_result) - print('统计参数中每个中文汉字出现的次数-->\n',cn_result) - + item_cn_set=set(item_cn) + for item1 in item_cn_set: + counter[item1]=item_cn.count(item1) + return sorted(counter.items(),key=lambda x:x[1],reverse=True) +cn_result=stats_text_cn(cn_text) +print(cn_result) \ No newline at end of file diff --git a/exercises/1901100148/d07/main.py b/exercises/1901100148/d07/main.py deleted file mode 100644 index 3b40f8159..000000000 --- a/exercises/1901100148/d07/main.py +++ /dev/null @@ -1,78 +0,0 @@ -text = ''' -愚公移山 - -太行王屋二山的北面住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他 -和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎 -樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎 -可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黄河河畔的智叟,看见他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀 -了,就是用盡你的氣力,也不能挖去山的一⻆呢?」 -愚公歎息道:「你有這樣的成见,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死 -了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有 -一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大 -力神揹走二山。 - -How The Foolish Old Man Moved Mountains - -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. - -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” - -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. - -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. - -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. - -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. - -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” - -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” - -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. - -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. - -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' - -# 模块导入stats_word -from mymodule import stats_word -result=stats_word.stats_text(text) # 调用stats_text() -print('统计结果==>',result) \ No newline at end of file diff --git a/exercises/1901100148/d07/mymodule/stats_word.py b/exercises/1901100148/d07/mymodule/stats_word.py deleted file mode 100644 index c67c6d32d..000000000 --- a/exercises/1901100148/d07/mymodule/stats_word.py +++ /dev/null @@ -1,86 +0,0 @@ -# 1. 定义一个名为 stats_text_en 的函数,函数接受一个字符串 text 作为参数 -# 函数元素有 函数名 参数 返回值 调用 -en_text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -def stats_text_en(text): # 统计参数中英文单词出现的次数,最后返回一个按词频降序排列的数组(列表) - # 分割文本为单词 - elements=text.split() - # 定义一个空列表,用于存放过滤后的单词 - words=[] - # 去掉非单词符号 - symbols='.,*-!' - for element in elements: - for symbol in symbols: - element=element.replace(symbol,'') - if len(element):#单词长度是否大于0,大于0则为单词,否则是空格 - words.append(element) - - # 初始化一个dict(字典)类型的变量,用来存放单词出现的次数 - counter={} - word_set=set(words) #set集合里的元素是无序且不重复的。 - for word in word_set: # 遍历的时候也会减少遍历的次数 - counter[word]=words.count(word) - # 函数返回值用 return 进行返回,如果没有 return 返回值则为 None。 - return sorted(counter.items(),key=lambda x:x[1],reverse=True) - - - - -# 2.定义stats_text_cn 函数,接受一个字符串作为参数,统计参数中每个汉字出现的次数,最后返回一个按字频降序排列的数组 -cn_text='''现在每个我遇见的笑着的人, -他们都不曾因为苦而放弃,他们只因扛而成长。 -谁不希望自己活得轻松,没有压力,一切随性, -但如果你真的那样去做的话,你会发现这个世界都在和你作对。 -如果有一天你真的觉得自己轻松了,那也不是因为生活越来越容易了, -而是因为我们越来越坚强。''' - -def stats_text_cn(text): - cn_characters = [] # characters字符 - for character in text: - # unicode 中 中文 字符的范围 - if'\u4e00'<=character<='\u9fff': - cn_characters.append(character) - counter={} - cn_character_set=set(cn_characters) # 把中文字符列表转化成一个集合的形式,去除重复的字符 - for character in cn_character_set: # 遍历集合 - counter[character]=cn_characters.count(character)#统计中文列表里字符的次数,且赋值给字典对应的项,就是字符出现的次数 - return sorted(counter.items(),key=lambda x:x[1],reverse=True) #进行降序排序 - - -#添加stats_text 的函数,实现功能:分别调⽤stats_text_en , stats_text_cn ,输出合并词频统计结果 -def stats_text(text): - return stats_text_en(text)+stats_text_cn(text) - - - -#搜索__name__==__main__ -#一般情况下在文件内 测试 代码的时候以下面的形式进行 -if __name__=='__main__': - en_result=stats_text_en(en_text) - cn_result=stats_text_cn(cn_text) - print('统计参数中每个英文单词出现的次数-->\n',en_result) - print('统计参数中每个中文汉字出现的次数-->\n',cn_result) - - diff --git a/exercises/1901100151/d10/main.py b/exercises/1901100151/d10/main.py deleted file mode 100644 index 592b25fb2..000000000 --- a/exercises/1901100151/d10/main.py +++ /dev/null @@ -1,13 +0,0 @@ -from stats_word import * -from os import path - -file_path = path.join(path.dirname(path.abspath(__file__)), 'tang300.json') -print('当前文件路径: ', __file__, '\n读取文件路径: ', file_path) - -with open(file_path, 'r', encoding = 'utf-8') as f: - a = [] - a = f.read() - try : - print('100中文词频统计结果:', stats_text_cn(a,100)) - except ValueError as ve: - print(ve) \ No newline at end of file diff --git a/exercises/1901100151/d10/stats_word.py b/exercises/1901100151/d10/stats_word.py deleted file mode 100644 index fef8b08dc..000000000 --- a/exercises/1901100151/d10/stats_word.py +++ /dev/null @@ -1,54 +0,0 @@ -import jieba -from collections import Counter -def stats_text_en(text): - """ - 统计英⽂单词词频的函数 - """ - if not isinstance(text, str): - raise ValueError("参数必须是str类型,输入类型%s" % type(text)) - a_text = text.split() - b_words = [] - c_text = ".,!?*-" - for d_text in a_text: - for e_text in c_text: - d_text = d_text.replace(e_text,"") - # error: 函数replace没有拼对。 - # error: d_text名称前后没有保持一致。 - if len(d_text) and d_text.isascii(): - b_words.append(d_text) - return b_words - -def stats_text_cn(text,count): - """ - 统计中⽂汉字字频的函数 - """ - if not isinstance(text, str): - raise ValueError("参数必须是str类型,输入类型%s" % type(text)) - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i) > 1: - tmp.append(i) - return Counter(tmp).most_common(count) - -def stats_text_text(text,count): - """ - 综合统计英⽂单词词频和中⽂汉字字频的函数,中英⽂词频统计的排序功能,使函数能够按照词频出现的次数有序输出。 - """ - a_text = stats_text_en(text) + stats_text_cn(text,9) - from collections import Counter - cnt = Counter() - for b_word in a_text: - cnt[b_word] += 1 - return cnt.most_common(count) - -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Sparse is better than dense. -封装统计英文文文单词词频的函数,封装统计中文汉字字频的函数. -''' - -if __name__ == '__main__': - print("词频统计的函数:\n",stats_text_text(text,9)) \ No newline at end of file diff --git a/exercises/1901100166/1001S02E02_hello_python.py b/exercises/1901100166/1001S02E02_hello_python.py deleted file mode 100644 index 00950d9ac..000000000 --- a/exercises/1901100166/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print('hello world') \ No newline at end of file diff --git a/exercises/1901100169/1001S02E05_array.py b/exercises/1901100169/1001S02E05_array.py deleted file mode 100644 index 79ee89b86..000000000 --- a/exercises/1901100169/1001S02E05_array.py +++ /dev/null @@ -1,24 +0,0 @@ -#1.将数组 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 翻转 -sample_list=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -reversed_list = sample_list[1:-1] -print('list reversed',reversed_list) - -#2. 翻转后的数组拼接成字符串 -joined_str = ''.join([str(i) for i in reversed_list]) -print('翻转后的数组拼接成字符串 ==>',joined_str) - -#3. 用字符串切片的方式取出第三到第八个字符(包含第三和第八个字符) -sliced_str = joined_str[2:8] -print('用字符串切片的方式取出第三到第八个字符==>',sliced_str) - -#4. 将获得的字符串进行翻转 -reversed_str = sliced_str[1:-1] -print('字符串翻转',reversed_str) - -#5. 将结果转换为 int 类型 -int_value = int(reversed_str) -print('转换为 int 类型',int_value) -#6. 分别转换成二进制,八进制,十六进制 -print('转换成二进制',bin(int_value)) -print('转换成八进制',oct(int_value)) -print('转换成进十六制',hex(int_value)) \ No newline at end of file diff --git a/exercises/1901100169/1001S02E05_stats_text.py b/exercises/1901100169/1001S02E05_stats_text.py deleted file mode 100644 index fbf7d5eca..000000000 --- a/exercises/1901100169/1001S02E05_stats_text.py +++ /dev/null @@ -1,40 +0,0 @@ -sample_text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -#1. 统计字符串样本 text 中各个英文单词出现的次数 -elements = sample_text.split() -words = [] -symbols = ',.-*!' -for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element): - words.append(element) -print('正常的英文单词',words) -counter = {} -word_set = set(words) -for word in word_set: - counter[word] = words.count(word) -print('英文单词出现的次数',counter) - -#2. 按照出现次数从大到小输出所有的单词及出现的次数 -print('从大到小输出所有的单词及出现的次数',sorted(counter.items(),key=lambda x:x[1],reverse=True)) diff --git a/exercises/1901100169/1001S02E05_string.py b/exercises/1901100169/1001S02E05_string.py deleted file mode 100644 index 0b7869336..000000000 --- a/exercises/1901100169/1001S02E05_string.py +++ /dev/null @@ -1,40 +0,0 @@ -sample_text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -#1. 将字符串串样本 text 里的 better 全部替换成 worse -text = sample_text.replace('better','worse') -print('将字符串样本里的 better,全部替换成 worse',text) -#2. 将单词中包含 ea 的单词剔除 -words = text.split() -filtered = [] -for word in words: - if word.find('ea')<0: - filtered.append(word) -print('将单词中包含 ea 的单词剔除',filtered) -#3. 进行大小写翻转 -swapcase=[i.swapcase() for i in filtered] -print('进行大小写翻转',swapcase) -#4. 按 a…z 升序排列 -print('单词按 a…z 升序排列',sorted(swapcase)) -#print('单词按 a…z 降序排列',sorted(swapcase,reverse=True)) - - diff --git a/exercises/1901100169/1001S02E06_stats_word.py b/exercises/1901100169/1001S02E06_stats_word.py deleted file mode 100644 index 2c711199f..000000000 --- a/exercises/1901100169/1001S02E06_stats_word.py +++ /dev/null @@ -1,70 +0,0 @@ -#封装统计英文单词词频的函数 -text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -def stats_text_en(text): - elements = text.split() # 形成单词列表,通过string的split()将字符串切成数组 - words = [] #定义一个列表,列表用[]括起 - symbols = ',.-*!' # 标示出标点符号 - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element): - words.append(element) - #print('正常的英文单词',words) - counter = {} - word_set = set(words) - for word in word_set: - counter[word] = words.count(word) - print('英文单词出现的次数',counter) - print('单词按 a…z 降序排列',sorted(counter.items(), key=lambda x:x[1],reverse=True)) - -print(stats_text_en(text)) - -import re -text1=''' -蜀人杜渭江朝绅令麻城,居官执法,不敢干以私。 -一日宴乡绅,梅西野倡令,要拆字入俗语二句。 -梅云:“单奚也是奚,加点也是溪,除却溪边点,加鸟却为鸡。 -俗语云:得志猫儿雄似虎,败翎鹦鹉不如鸡。” -毛石崖云:“单青也是青,加点也是清。 -除却清边点,加心却为情。 -俗语云:火烧纸马铺,落得做人情。” -杜答云:“单相也是相,加点也是湘。 -除却湘边点,加雨却为霜。 -俗语云:各人自扫门前雪,莫管他家瓦上霜。” -又云:“单其也是其,加点也是淇。 -除却淇边点,加欠却为欺。 -俗语云:龙居浅水遭虾戏,虎落平阳被犬欺。” -(《古今谭概·谈资部·梅、郭二令相同》) -''' -def stats_text_cn(text1): - p=re.compile(r'[\u4e00-\u9fa5]') # 中文的编码范围是\u4e00到\u9fa5] - res=re.findall(p,text1) #Chinese choosen - counter={} - for i in res: - counter[i]=res.count(i) - counter=sorted(counter.items(),key=lambda x:x[1],reverse=True) - print(counter) - return -print(stats_text_cn(text1)) - diff --git a/exercises/1901100169/D7/mymodule/main.py b/exercises/1901100169/D7/mymodule/main.py deleted file mode 100644 index 84f0fbf5f..000000000 --- a/exercises/1901100169/D7/mymodule/main.py +++ /dev/null @@ -1,2 +0,0 @@ -from stats_word import* -print(stats_text(text_en_cn)) diff --git a/exercises/1901100169/D7/mymodule/stats_word.py b/exercises/1901100169/D7/mymodule/stats_word.py deleted file mode 100644 index 934c88293..000000000 --- a/exercises/1901100169/D7/mymodule/stats_word.py +++ /dev/null @@ -1,73 +0,0 @@ -#封装统计英文单词词频的函数 -text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -def stats_text_en(text): - elements = text.split() # 形成单词列表,通过string的split()将字符串切成数组 - words = [] #定义一个列表,列表用[]括起 - symbols = ',.-*!' # 标示出标点符号 - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element): - words.append(element) - #print('正常的英文单词',words) - counter = {} - word_set = set(words) - for word in word_set: - counter[word] = words.count(word) - #print('英文单词出现的次数',counter) - print('英文字数并按降序排列',sorted(counter.items(), key=lambda x:x[1],reverse=True)) - -print(stats_text_en(text)) - -import re -text1=''' -蜀人杜渭江朝绅令麻城,居官执法,不敢干以私。 -一日宴乡绅,梅西野倡令,要拆字入俗语二句。 -梅云:“单奚也是奚,加点也是溪,除却溪边点,加鸟却为鸡。 -俗语云:得志猫儿雄似虎,败翎鹦鹉不如鸡。” -毛石崖云:“单青也是青,加点也是清。 -除却清边点,加心却为情。 -俗语云:火烧纸马铺,落得做人情。” -杜答云:“单相也是相,加点也是湘。 -除却湘边点,加雨却为霜。 -俗语云:各人自扫门前雪,莫管他家瓦上霜。” -又云:“单其也是其,加点也是淇。 -除却淇边点,加欠却为欺。 -俗语云:龙居浅水遭虾戏,虎落平阳被犬欺。” -(《古今谭概·谈资部·梅、郭二令相同》) -''' -def stats_text_cn(text1): - p=re.compile(r'[\u4e00-\u9fa5]') # 中文的编码范围是\u4e00到\u9fa5] - res=re.findall(p,text1) #Chinese choosen - counter={} - for i in res: - counter[i]=res.count(i) - counter=sorted(counter.items(),key=lambda x:x[1],reverse=True) - print('中文字数统计',counter) - return -print(stats_text_cn(text1)) - -#分别调用以上两个函数,输出合并词频统计结果 -def stats_text(text_en_cn): - return(stats_text_cn(text_en_cn)+stats_text_en(text_en_cn)) \ No newline at end of file diff --git a/exercises/1901100169/D8/mymodule/main.py b/exercises/1901100169/D8/mymodule/main.py deleted file mode 100644 index fa26a8e87..000000000 --- a/exercises/1901100169/D8/mymodule/main.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Fri Sep 27 10:51:15 2019 - -""" -import stats_word -#text=input('请输入英文:\n') -def a(text): - try: - stats_word.stats_text_en(text) - except ValueError: - raise ValueError('请确认输入英文') - return -#a(text) - -text1=input('请输入中文:\n') -def b(text1): - try: - stats_word.stats_text_cn(text1) - except ValueError: - raise ValueError('请确认输入中文') - return -b(text1) diff --git a/exercises/1901100169/D8/mymodule/stats_word.py b/exercises/1901100169/D8/mymodule/stats_word.py deleted file mode 100644 index ae386e37c..000000000 --- a/exercises/1901100169/D8/mymodule/stats_word.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Wed Sep 25 14:43:52 2019 - -""" - -#text=input('请输入英文:\n') -def stats_text_en(text): - if text.isascii() and text.isdigit()==0: - x='*-,.!@#$%^&()_\?><=+' #列出要替换的标点符号 - words_dict={} #空字典 - for c in x: #按每个标点在X里面循环 - text=(text.replace(c,'')) #重置的text的值 - words=text.lower().split() #将text小写字母化后切片给words赋值 - b=set(words) #将words去掉重复项赋值给B - for word in b: #在B里的每个单词循环 - d=words.count(word) #计算每个单词在words里出现的次数,赋值给D - words_dict[word]=d #每个单词及出现的次数以字典的方式存储在words_dict - e=sorted(words_dict.items(),key=lambda t:t[1],reverse=True) #将字典里的项目按值的大小降序排列 - print(e) #打印E - else: - raise ValueError#('请输入正确英文文本') - return -#stats_text_en(text) - -#text1=input('请输入中文:\n') -def stats_text_cn (text1): #定义函数stats_text_cn - if text1 >= u'\u4e00' and text1<=u'\u9fa5': - import re #导入模块 - i=r"[\u4e00-\u9fa5]" #unicode代码库 - j= re.compile(i) #将创建的模式对像赋值给J - k= re.findall(j,text1) #将与模式与文本匹配得到的unicode代码赋值给K - dict={} #建空字典 - for l in k: #在K内每个字循环 - m=k.count(l) #计算每个字K里出现的次数赋值给M - dict[l]=m #将每一项存入字典 - q=sorted(dict.items(),key=lambda y:y[1],reverse=True) #字典项按出现次数降序 - print(q) #打印排序后的结果 - else: - raise ValueError#('请输入正确中文文本') - return #返回 -#stats_text_cn(text1) -def stats_text(): - z=stats_text_en(text) - v=stats_text_cn(text1) - return - - - \ No newline at end of file diff --git a/exercises/1901100202/1001S02E03_calculator.py b/exercises/1901100202/1001S02E03_calculator.py deleted file mode 100644 index 4c6b280df..000000000 --- a/exercises/1901100202/1001S02E03_calculator.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -实现一个简单的计算器 -1 接收用户输入的第一个数字 -2 接受用户输入的运算符 -3 接受用户输入的第二个数字 -4 代码进行判断,计算 -5 显示计算的结果 -""" -while True: - # 实现一个简单的计算器 - # 1 接收用户输入的第一个数字 - first_num = input("请输入第一个数字:") - first_num = int(first_num) - # 2 接受用户输入的运算符 - symbol = input ("请输入运算符(+,-,*,/):") - # 3 接受用户输入的第二个数字 - second_num = input ("请输入第二个数字:") - second_num = int(second_num) - # 4 代码进行判断,计算 - # 4.1 如果运算符为+,进行加法运算 - if symbol == "+": - result = first_num + second_num - print(f'{first_num} {symbol} {second_num} = {result}') - # print(result) - # 4.2 如果运算符为-,进行减法运算 - elif symbol == "-": - result = first_num - second_num - print(f'{first_num} {symbol} {second_num} = {result}') - # print(result) - # 4.3 如果运算符为*,进行乘法运算 - elif symbol == "*": - result = first_num * second_num - print(f'{first_num} {symbol} {second_num} = {result}') - # print(result) - # 4.4 如果运算符为/,进行除法运算 - elif symbol == "/": - if second_num == 0: - result = "除数不能等于0" - print(result) - else: - result = first_num / second_num - print(f'{first_num} {symbol} {second_num} = {result}') - # print(result) - # 4.5 如果输入的符号不正确,提示错误 - else: - result = "输入错误" - print(result) - # 5 显示计算的结果 显示出完整的格式,eg:1 + 1 = 2 - # 格式化输出 format - # print(result) - # print(f'{first_num} {symbol} {second_num} = {result}') - - diff --git a/exercises/1901100202/1001S02E04_control_flow.py b/exercises/1901100202/1001S02E04_control_flow.py deleted file mode 100644 index 9b841a135..000000000 --- a/exercises/1901100202/1001S02E04_control_flow.py +++ /dev/null @@ -1,12 +0,0 @@ -for i in range(1,10): # 输出9行 - for j in range(1,i+1): # 输出与函数相等的列 - print(str(j)+"×"+str(i)+"="+str(i*j)+"\t",end='') - print("") # 换行 - -for a in range(1,10): - for b in range(1,a+1): - while a % 2 != 0: - print(str(b)+'×'+str(a)+'='+str(a*b)+'\t',end='') - if a == b: - print() - break diff --git a/exercises/1901100229/1001S02E06_stats_word.py b/exercises/1901100229/1001S02E06_stats_word.py deleted file mode 100755 index a14613b21..000000000 --- a/exercises/1901100229/1001S02E06_stats_word.py +++ /dev/null @@ -1,76 +0,0 @@ -#1.封装统计英文字频的函数 -en_text = ''' -The Zen of Python , by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implcit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases are't special enough to break the rules. -Although practicality beats purity. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one --- and preferably only one -- obvious way to do it. -Although the way may not be obvious at first unless you are a Dutch. -Now is better than never. -Although never is better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it's maybe a good idea. -Namespaces are one honking great idea --- let's do more of those! -''' - -def stats_text_en(text): #定义一个名为stats_text_en,接收text为参数的函数 - symbols = '~!@#$%^&*(),.[]{}|?/;<>' - for i in symbols: - text=text.replace(i, ' ') #通过for...in...循环,把所有可能出现的特殊字符都替换成空格 - text=text.lower() #所有字母变成小写 - text=text.split() #文本转列表 - dict1={} #新建一个空字典 - for i in text: #指定i遍历text中的元素 - j=text.count(i) #统计text中各单词的数量,这一步可以优化,因为有些单词出现了不止一遍,相当于同一个单词统计了好几遍 - dict2={i:j} - dict1.update(dict2) - return sorted(dict1.items(),key=lambda x:x[1],reverse=True) - - -print(stats_text_en(en_text)) - - -#2.封装统计中文汉字字频的函数 -cn_text = ''' -美丽胜过丑陋。 -显式优于隐式。 -简单比复杂更好。 -复杂比复杂更好。 -优于嵌套。 -稀疏优于密集。 -可读性很重要。 -特殊情况不足以打破规则。 -虽然实用性胜过纯洁。 -错误不应该默默地传递。 -除非明确沉默。 -面对困惑,拒绝猜测的诱惑。 -应该有一个 - 最好只有一个 - 明显的方法来做到这一点。 -虽然这种方式起初可能并不明显,除非你是荷兰人。 -现在比永远好。 -虽然现在永远不会比*正确好。 -如果实施很难解释,这是一个坏主意。 -如果实现很容易解释,那可能是个好主意。 -命名空间是一个很棒的主意 - 让我们做更多的事情吧! -''' - -def stats_text_cn(text): #定义一个名为stats_text_cn,接受text为参数的函数 - dict_1={} - for i in text: - if u'\u4e00' <= i <= u'\u9fff':#使用正则表达式判断是不是中文 - count = text.count(i) - dict_2 = {i:count} - dict_1.update(dict_2) - return sorted(dict_1.items(),key=lambda item:item[1],reverse = True) - -print(stats_text_cn(cn_text)) #调用函数并打印结果 - - \ No newline at end of file diff --git a/exercises/1901100254/1001S02E01_helloworld.txt b/exercises/1901100254/1001S02E01_helloworld.txt index 799414a83..54ae41c94 100644 --- a/exercises/1901100254/1001S02E01_helloworld.txt +++ b/exercises/1901100254/1001S02E01_helloworld.txt @@ -1,3 +1 @@ - -hello world - +Apple \ No newline at end of file diff --git a/exercises/1901100254/1001S02E05_array.py b/exercises/1901100254/1001S02E05_array.py deleted file mode 100644 index 9ba10d40b..000000000 --- a/exercises/1901100254/1001S02E05_array.py +++ /dev/null @@ -1,36 +0,0 @@ - -# 列表也可以叫做数组 大家不要感到迷惑 - -# 1. 对列表 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 翻转 - -sample_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -reversed_list = sample_list[::-1] -print('列表翻转==>', reversed_list) - -# 2. 翻转后的列表拼接成字符串 - -# 调用''(空字符串) str 类型的 join 方法可以连接 列表 里的元素, 用''(空字符串)表示连接的适合元素间不用任何字符隔开 -# 因为 reversed_list 里面都是 int 类型的元素,所以拼接之前要把 reversed_list 变成一个包含 str 类型元素的 列表 -joined_str = ''.join([str(i) for i in reversed_list]) -print('翻转后的数组拼接成字符串 ==>', joined_str) - -# 3. 用字符串切片的方式取出第三到第八个字符(包含第三和第八个字符) - -# 切片的时候包含 开始 索引,不包含结尾的索引 -sliced_str = joined_str[2:8] -print('用字符串切片的方式取出第三到第八个字符 ==>', sliced_str) - -# 4. 获得的字符串进行翻转 - -reversed_str = sliced_str[::-1] -print('字符串翻转 ==>', reversed_str) - -# 5. 转换为 int 类型 -int_value = int(reversed_str) - -print('转换为 int 类型 ==>', int_value) - -print('转换为 二进制==>', bin(int_value)) -print('转换为 八进制==>', oct(int_value)) -print('转换为 十六进制==>', hex(int_value)) - diff --git a/exercises/1901100254/1001S02E05_stats_text.py b/exercises/1901100254/1001S02E05_stats_text.py deleted file mode 100644 index ea0a027dd..000000000 --- a/exercises/1901100254/1001S02E05_stats_text.py +++ /dev/null @@ -1,68 +0,0 @@ - -sample_text = ''' - -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - - -# 1. 使用字典(dict 类型) 统计字符串样本 text 中各个英文单词出现的次数 - -# 先将字符串根据 空白字符 分割成 list, 要调用 str 类型 -elements = sample_text.split() - -# 定义一个新的 list 型变量,存储处理过的单词# 定义一个新的 list 型变量,存储处理过的单词 -words = [] - -# 先针对样本文本挑选出需要剔除的非单词符号 -symbols = ',.*-!' - -for element in elements: - #遍历一遍要剔除的符号 - for symbol in symbols: - # 逐个替换字符号,用''是为了同时剔除符号所占的位置 - element = element.replace(symbol,'') -# 剔除了字符后如果 element 的长度不为 0,则算作正常单词 -if len(element): - words.append(element) - -print('正常的英文单词 ==>', words) - -# 初始化一个 dict (字典)类型的变量,用来存放单词出现的次数 -counter = {} - -# set(集合) 类型 可以去掉 列表 里的重复元素,可以再for...in 里减少循环次数 -word_set = set(words) - -for word in word_set: - counter[word] = words.count(word) - -print('英文单词出现的次数 ==>', counter) - -# 2. 按照出现次数从大到小输出所有的单词及出现的次数 - -# 内置函数 sorted 的参数 key 表示按元素的那一项的值进行排序 -# dict 类型 counter 的 items 方法会返回一个 包含 相应 项 (key, value) 的 元组 列表 -# print('counter.items() ==>', counter.items()) -print('从大到小输出所有的单词及出现的次数 ==>', sorted(counter.items(), key=lambda x: x[1], reverse=True)) - diff --git a/exercises/1901100254/1001S02E05_string.py b/exercises/1901100254/1001S02E05_string.py deleted file mode 100644 index 403018df6..000000000 --- a/exercises/1901100254/1001S02E05_string.py +++ /dev/null @@ -1,58 +0,0 @@ - -sample_text = ''' - -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -# 1. 将字符串样本里的 better 全部替换成 worse - -# 调用 str 类型的 replace 方法进行替换 -text = sample_text.replace('better', 'worse') -print('将字符串样本里的 better 全部替换成 worse ==>', text, '\n') - - -# 2. 将单词中包含 ea 的单词剔除 - -# 先将字符串根据 空白字符 分割成 list, 要调用 str 类型 -words = text.split() -# 定义一个 list 类型的变量用来存放过滤完的单词 -filtered = [] -# 用 for ... in 循环遍历一遍 words 里的元素然后判断单词是否包含 ea -for word in words: - # str 类型的 find 方法 如果不包含 参数 字符则返回 -1, 如果包含则返回该字符第一次出现时的索引 - if word.find('ea') < 0: - filtered.append(word) -print('将单词中包含 ea 的单词剔除==>', filtered, '\n') - - -# 3. 进行大小写翻转 -# 利用 列表推到式 对 str 类型的元素进行大小写翻转 -swapcased = [i.swapcase() for i in filtered] -print('进行大小写翻转 ==>', swapcased, '\n') - - -# 4. 单词按 a...z 升序排列 -print('单词按 a...z 升序排列 ==>', sorted(swapcased)) -# print('单词按 a...z 降序排列 ==>', sorted(swapcased, reverse=True)) - diff --git a/exercises/1901100254/1001S02E06_stats_word.py b/exercises/1901100254/1001S02E06_stats_word.py deleted file mode 100644 index 632eb835e..000000000 --- a/exercises/1901100254/1001S02E06_stats_word.py +++ /dev/null @@ -1,91 +0,0 @@ -# 自定义函数,该函数用于统计参数text中每个英文单词出现的次数,最后返回一个按词频降序排列的数组 -def stats_text_en(text): - - elements = text.split() # 先将字符串根据 空白字符 分割成 list, 要调用 str 类型 - words = [] # 定义一个新的 list 型变量,存储处理过的单词 - symbols = ',.*-!' # 先针对样本文本挑选出需要剔除的非单词符号 - - for element in elements: # 在列表text1中遍历一遍要剔除的符号 - for symbol in symbols: # 如果包含symbols中需要剔除的字符,用replace语句替换掉 - element = element.replace(symbol, '') # 逐个替换字符号,用''是为了同时剔除符号所占的位置 - if len(element): # 剔除了字符后如果单词En的长度不为0,那么就算正常单词,可以加入到新的列表中 - words.append(element) - counter = {} - word_set = set(words) - - for word in word_set: - counter[word] = words.count(word) - # 函数返回值用 return 进行返回,如果没有 return 返回值则为 None - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text): - cn_characters = [] - for character in text: - # unicode 中 中文 字符的范围 - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - counter = {} - cn_character_set = set(cn_characters) - for character in cn_character_set: - counter[character] = cn_characters.count(character) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - -en_text = ''' - -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - - - -cn_text = ''' -Python之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -即便假借特例的实用性之名,也不可违背这些规则 -不要包容所有错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是 python 之父 -做也许好过不做,但不假思索就动手还不如不做 -。。。 -''' - - -# 搜索 __name__ == __main__ -# 一般情况下再文件内 测试 代码的时候以下面的形式进行 -if __name__ == '__main__': - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) - print('统计参数中每个英文单词出现的次数 ==>\n', en_result) - print('统计参数中每个中文汉字出现的次数 ==>\n', cn_result) - diff --git a/exercises/1901100254/d07/main.py b/exercises/1901100254/d07/main.py deleted file mode 100644 index 53472859d..000000000 --- a/exercises/1901100254/d07/main.py +++ /dev/null @@ -1,37 +0,0 @@ -from mymodule import stats_word - -sample_text = ''' -愚公移山 - -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,檔住去路,使他 和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎 樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鏊一個小丘的力量都沒有,怎 可能剷平太行、王屋二山昵?況且,鏊出的土石又丟到哪裏去昵?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀 了,就是用盡你的氣力,也不能挖去山的一角昵?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如昵!就算我死 了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有 一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大 力神揹走二山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked yugong's way making it inconvenient for him and his family to get around. -One day yugong gathered his family together and said,"Let's do our best to level these two mountains. We shall open a road that leads to Yuzhou. What do you think?" -All but his wife agreed with him. -"You don't have the strength to cut even a small mound," muttered his wife. "How on earth do you suppose you can level Mount Taixin and Mount Wanwu? Moreover, where will all the earth and rubble go?" -"Dump them into the Sea of Bohaii" said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. -Now Yugong's neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed Yugong sayingr"Aren't you foolish, my friend? You are very old now, and with whatever remains of your waning strength, you won't be able to remove even a corner of the mountain." -Yugong uttered a sigh and said,"A biased person like you will never understand. You can't even compare with the widow's little boyl" -"Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. -''' - - -result = stats_word.stats_text(sample_text) -print('统计结果 ==>', result) \ No newline at end of file diff --git a/exercises/1901100254/d07/mymodule/main.py b/exercises/1901100254/d07/mymodule/main.py deleted file mode 100644 index 00dcf34f2..000000000 --- a/exercises/1901100254/d07/mymodule/main.py +++ /dev/null @@ -1,32 +0,0 @@ -text = ''' -愚公移山 -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,檔住去路,使他 和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎 樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鏊一個小丘的力量都沒有,怎 可能剷平太行、王屋二山昵?況且,鏊出的土石又丟到哪裏去昵?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀 了,就是用盡你的氣力,也不能挖去山的一角昵?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如昵!就算我死 了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有 一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大 力神揹走二山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked yugong's way making it inconvenient for him and his family to get around. -One day yugong gathered his family together and said,"Let's do our best to level these two mountains. We shall open a road that leads to Yuzhou. What do you think?" -All but his wife agreed with him. -"You don't have the strength to cut even a small mound," muttered his wife. "How on earth do you suppose you can level Mount Taixin and Mount Wanwu? Moreover, where will all the earth and rubble go?" -"Dump them into the Sea of Bohaii" said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. -Now Yugong's neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he ridiculed Yugong sayingr"Aren't you foolish, my friend? You are very old now, and with whatever remains of your waning strength, you won't be able to remove even a corner of the mountain." -Yugong uttered a sigh and said,"A biased person like you will never understand. You can't even compare with the widow's little boyl" -"Even if I were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he declared with confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. -''' -import stats_word -stats_word.stats_text(text) \ No newline at end of file diff --git a/exercises/1901100254/d07/mymodule/stats_word.py b/exercises/1901100254/d07/mymodule/stats_word.py deleted file mode 100644 index eff85cbdf..000000000 --- a/exercises/1901100254/d07/mymodule/stats_word.py +++ /dev/null @@ -1,103 +0,0 @@ - -# 统计参数中每个英文单词出现的次数 -def stats_text_en(text): - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - # 用 str 类型 的 isascii 方法判断是否是英文单词 - if len(element) and element.isascii(): - words.append(element) - counter = {} - word_set = set(words) - - for word in word_set: - counter[word] = words.count(word) - # 函数返回值用 return 进行返回,如果没有 return 返回值则为 None - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text): - cn_characters = [] - for character in text: - # unicode 中 中文 字符的范围 - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - counter = {} - cn_character_set = set(cn_characters) - for character in cn_character_set: - counter[character] = cn_characters.count(character) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - -def stats_text(text): - ''' - 合并 英文词频 和 中文词频 的结果 - ''' - return stats_text_en(text) + stats_text_cn(text) - - - -if __name__ == '__main__': - en_text = ''' -The Zen of Python, by Tim Peters - - - -text = ''' -The Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! - -''' - - -cn_text = ''' -Python之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -即便假借特例的实用性之名,也不可违背这些规则 -不要包容所有错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是 python 之父 -做也许好过不做,但不假思索就动手还不如不做 -。。。 -''' - - -# 搜索 __name__ == __main__ -# 一般情况下再文件内 测试 代码的时候以下面的形式进行 -if __name__ == '__main__': - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) - print('统计参数中每个英文单词出现的次数 ==>\n', en_result, '\n') - print('统计参数中每个中文汉字出现的次数 ==>\n', cn_result, '\n') - diff --git a/exercises/1901100254/d08/main.py b/exercises/1901100254/d08/main.py deleted file mode 100644 index 563eb7b88..000000000 --- a/exercises/1901100254/d08/main.py +++ /dev/null @@ -1,26 +0,0 @@ - -from mymodule import stats_word -import traceback -import logging -logger = logging.getLogger(__name__) - -# 用 try...except 捕获异常 -def test_traceback(): - try: - stats_word.stats_text(1) - except Exception as e: - print('test_traceback =>', e) - print(traceback.format_exc()) - -def test_logger(): - try: - stats_word.stats_text(1) - except Exception as e: - logger.exception(e) - - -if __name__ == '__main__': - test_traceback() - test_logger() - - diff --git a/exercises/1901100254/d08/mymodule/stats_word.py b/exercises/1901100254/d08/mymodule/stats_word.py deleted file mode 100644 index 4e6933202..000000000 --- a/exercises/1901100254/d08/mymodule/stats_word.py +++ /dev/null @@ -1,105 +0,0 @@ -import re # 引入正则表达式,以便操作字符串 -import collections # 引入collections模块,以便使用计数功能 - -# 统计参数中每个英文单词出现的次数 -def stats_text_en(text): - if type(text) != str: - raise ValueError('非字符串类型') - elements = text.split() - words = [] - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol, '') - # 用 str 类型 的 isascii 方法判断是否是英文单词 - if len(element) and element.isascii(): - words.append(element) - counter = {} - word_set = set(words) - - for word in word_set: - counter[word] = words.count(word) - # 函数返回值用 return 进行返回,如果没有 return 返回值则为 None - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text): - if type(text) != str: - raise ValueError('非字符串类型') - cn_characters = [] - for character in text: - # unicode 中 中文 字符的范围 - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - counter = {} - cn_character_set = set(cn_characters) - for character in cn_character_set: - counter[character] = cn_characters.count(character) - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - -def stats_text(text): - ''' - 合并 英文词频 和 中文词频 的结果 - ''' - if type(text) != str: - raise ValueError('非字符串类型') - return stats_text_en(text) + stats_text_cn(text) - - - -if __name__ == '__main__': - en_text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - - -cn_text = ''' -Python之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -即便假借特例的实用性之名,也不可违背这些规则 -不要包容所有错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是 python 之父 -做也许好过不做,但不假思索就动手还不如不做 -。。。 -''' - - -# 搜索 __name__ == __main__ -# 一般情况下再文件内 测试 代码的时候以下面的形式进行 -if __name__ == '__main__': - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) - print('统计参数中每个英文单词出现的次数 ==>\n', en_result, '\n') - print('统计参数中每个中文汉字出现的次数 ==>\n', cn_result, '\n') diff --git a/exercises/1901100271/d07/main.py b/exercises/1901100271/d07/main.py index 36a131573..1198aedb7 100644 --- a/exercises/1901100271/d07/main.py +++ b/exercises/1901100271/d07/main.py @@ -59,6 +59,6 @@ Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. ''' -stats_word.stats_text(text) +print(stats_word.stats_text(text)) diff --git a/exercises/1901100271/d07/mymodule/main.py b/exercises/1901100271/d07/mymodule/main.py index a70dbaa84..0313b7397 100644 --- a/exercises/1901100271/d07/mymodule/main.py +++ b/exercises/1901100271/d07/mymodule/main.py @@ -1,2 +1,2 @@ import stats_word -print(stats_word.stats_text(text)) +print(stats_text(text)) diff --git a/exercises/1901100271/d07/mymodule/stats_word.py b/exercises/1901100271/d07/mymodule/stats_word.py index 6dbc78bc2..c350f9668 100644 --- a/exercises/1901100271/d07/mymodule/stats_word.py +++ b/exercises/1901100271/d07/mymodule/stats_word.py @@ -26,3 +26,4 @@ def stats_text_cn(text): def stats_text(text): print("文本中的中文汉字词频为:\n",stats_text_cn(text)) print("文本中的英文单词词频为:\n",stats_text_en(text)) + return \ No newline at end of file diff --git a/exercises/1901100271/d08/main.py b/exercises/1901100271/d08/main.py index ba4916107..5a805b2f3 100644 --- a/exercises/1901100271/d08/main.py +++ b/exercises/1901100271/d08/main.py @@ -1,22 +1,7 @@ from mymodule import stats_word - -import traceback #引入trackback模块 - -text = 1, 2, 3 -'''try: +text = 1,2,3 +try: stats_word.stats_text(text) except ValueError: - print("错误:文本为非字符串格式")''' - - -def text1_traceback(): #定义一个含有try,except的函数 - try: - stats_word.stats_text(text) - except Exception as e: - print('text1_traceback =>', e) - print(traceback.format_exc()) #通过trackback.format.exc()输出字符串格式 - - -if __name__ == "__main__": - text1_traceback() + print("错误:文本为非字符串格式") diff --git a/exercises/1901100271/d08/mymodule/main.py b/exercises/1901100271/d08/mymodule/main.py index 1f50e16bd..760a25b26 100644 --- a/exercises/1901100271/d08/mymodule/main.py +++ b/exercises/1901100271/d08/mymodule/main.py @@ -1,7 +1,4 @@ - -import stats_word - - +from mymodule import stats_word text = 123 try: stats_word.stats_text(text) diff --git a/exercises/1901100271/d08/mymodule/stats_word.py b/exercises/1901100271/d08/mymodule/stats_word.py index fb1005ff6..596ea3828 100644 --- a/exercises/1901100271/d08/mymodule/stats_word.py +++ b/exercises/1901100271/d08/mymodule/stats_word.py @@ -1,5 +1,4 @@ import re - def stats_text_en(text): if type(text) != str: raise ValueError("非字符串格式,请重新输入") @@ -8,9 +7,7 @@ def stats_text_en(text): text = re.sub("[^A-Za-z]", " ", text) text = text.split() d = {} - - for i in text: - + for i in text: a = text.count(i) d[i] = a d1 = sorted(d.items(), key = lambda item : item[1], reverse = True) @@ -35,10 +32,3 @@ def stats_text(text): raise ValueError("非字符串格式,请重新输入") print("文本中的中文汉字词频为:\n",stats_text_cn(text)) print("文本中的英文单词词频为:\n",stats_text_en(text)) - - - -if __name__ == "__main__": - stats_text(1) - - diff --git a/exercises/1901100271/d09/main.py b/exercises/1901100271/d09/main.py deleted file mode 100644 index 406059dd3..000000000 --- a/exercises/1901100271/d09/main.py +++ /dev/null @@ -1,19 +0,0 @@ -from mymodule import stats_word -import traceback - -with open("C:\\Users\\noodl\\Desktop\\Github\\selfteaching-python-camp\\exercises\\1901100271\\d09\\tang300.json", encoding='UTF-8') as f: - data = f.read() - - -# 定义一个含有try,except的函数 -def text1_traceback(): - try: - print(stats_word.stats_text_cn(data, 100)) - except Exception as e: - print('text1_traceback =>', e) - print(traceback.format_exc()) -# 通过trackback.format.exc()输出字符串格式''' - - -if __name__ == "__main__": - text1_traceback() diff --git a/exercises/1901100271/d09/mymodule/main.py b/exercises/1901100271/d09/mymodule/main.py deleted file mode 100644 index 35fb67545..000000000 --- a/exercises/1901100271/d09/mymodule/main.py +++ /dev/null @@ -1,7 +0,0 @@ -import stats_word - -text = 123 -try: - stats_word.stats_text(text) -except ValueError as error: - print(error) diff --git a/exercises/1901100271/d09/mymodule/stats_word.py b/exercises/1901100271/d09/mymodule/stats_word.py deleted file mode 100644 index 4379a1c74..000000000 --- a/exercises/1901100271/d09/mymodule/stats_word.py +++ /dev/null @@ -1,95 +0,0 @@ -import re -from collections import Counter -dna = ''' -愚公移⼭ -太⾏,王屋⼆⼭的北⾯,住了⼀個九⼗歲的⽼翁,名叫愚公。⼆⼭佔地廣闊,擋住去路,使他 -和家⼈往來極為不便。 -⼀天,愚公召集家⼈說:「讓我們各盡其⼒,剷平⼆⼭,開條道路,直通豫州,你們認為怎 -樣?」 -⼤家都異⼝同聲贊成,只有他的妻⼦表示懷疑,並說:「你連開鑿⼀個⼩丘的⼒量都沒有,怎 -可能剷平太⾏、王屋⼆⼭呢?況且,鑿出的⼟⽯⼜丟到哪裏去呢?」 -⼤家都熱烈地說:「把⼟⽯丟進渤海裏。」 -於是愚公就和兒孫,⼀起開挖⼟,把⼟⽯搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒⼦⼋歲也興致勃勃地⾛來幫忙。 -寒來暑往,他們要⼀年才能往返渤海⼀次。 -住在⿈河河畔的智叟,看⾒他們這樣⾟苦,取笑愚公說:「你不是很愚蠢嗎?你已⼀把年紀 -了,就是⽤盡你的氣⼒,也不能挖去⼭的⼀⻆呢?」 -愚公歎息道:「你有這樣的成⾒,是不會明⽩的。你⽐那寡婦的⼩兒⼦還不如呢!就算我死 -了,還有我的兒⼦,我的孫⼦,我的曾孫⼦,他們⼀直傳下去。⽽這⼆⼭是不會加⼤的,總有 -⼀天,我們會把它們剷平。」 -智叟聽了,無話可說: -⼆⼭的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤ -⼒神揹⾛⼆⼭。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' - - -def stats_text_en(text, count): - if type(text) != str: - raise ValueError("非字符串格式,请重新输入") - text = re.sub("[^A-Za-z]", " ", text.lower()).split() - d = {} - for i in text: - a = text.count(i) - d[i] = a - return Counter(d).most_common(count) - - -def stats_text_cn(text, count): - if type(text) != str: - raise ValueError("非字符串格式,请重新输入") - text1 = [] - [text1.append(cn) for cn in text if '\u4e00' <= cn <= '\u9fa5'] - d = {} - for zh in text1: - d[zh] = text1.count(zh) - return Counter(d).most_common(count) - - -def stats_text(text, n): - if type(text) != str: - raise ValueError("非字符串格式,请重新输入") - print("文本中的中文汉字词频为:\n", stats_text_cn(text, n)) - print("文本中的英文单词词频为:\n", stats_text_en(text, n)) - - -if __name__ == "__main__": - stats_text(dna, 10) diff --git a/exercises/1901100274/1001S02E03_calculator.py b/exercises/1901100274/1001S02E03_calculator.py deleted file mode 100644 index 9c88f84a1..000000000 --- a/exercises/1901100274/1001S02E03_calculator.py +++ /dev/null @@ -1,14 +0,0 @@ -print('HELLO,this is a calculator program:') -first = int(input('Please input first number>>>')) -kind = input('Please input operator: + - * / >>>') -second = int(input('Please input second number>>>')) -if kind == "+": - print(first + second) -elif kind == "-": - print(first - second) -elif kind == "*": - print(first * second) -elif kind == "/": - print(first / second) -else: - print("invaild input") \ No newline at end of file diff --git a/exercises/1901100275/1001S02E01_helloworld.txt b/exercises/1901100275/1001S02E01_helloworld.txt deleted file mode 100644 index d816dca01..000000000 --- a/exercises/1901100275/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -д \ No newline at end of file diff --git a/exercises/1901100275/1001S02E02_hello_python.py b/exercises/1901100275/1001S02E02_hello_python.py deleted file mode 100644 index df1dc6821..000000000 --- a/exercises/1901100275/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print('Hello World') diff --git a/exercises/1901100275/1001S02E03_calculator.py b/exercises/1901100275/1001S02E03_calculator.py deleted file mode 100644 index 7976434d2..000000000 --- a/exercises/1901100275/1001S02E03_calculator.py +++ /dev/null @@ -1,18 +0,0 @@ -operator=input -first_number=input -second_number=input -a=int(first_number) -b=int(second_number) -print("operator:",operator,type(operator)) -print("first_number:",first_number,type(first_number)) -print("second_number:",second_number,type(second_number)) -if operator=="+": - print(a,'+',b,'=:',a+b) -elif operator=="-": - print(a,'-',b,'=:',a-b) -elif operator=="*": - print(a,'*',b,'=:',a*b) -elif operator=="/": - print(a,'/',b,'=',a/b) -else: - print('无效的运算符') \ No newline at end of file diff --git a/exercises/1901100275/1001S02E04_control_flow.py b/exercises/1901100275/1001S02E04_control_flow.py deleted file mode 100644 index d93f88790..000000000 --- a/exercises/1901100275/1001S02E04_control_flow.py +++ /dev/null @@ -1,19 +0,0 @@ -i=0 -while i <9: - i+=1 - a=0 - while a <9: - a+=1 - if int(i)%2!=0: - print('%d*%d=%d'%(i,a,i*a),end=' ') - if i==a: - print('') - break - - -for i in range(1,10): - for a in range(1,i+1): - print('%d*%d=%d'%(i,a,i*a),end=' ') - if i==a: - print('') - break \ No newline at end of file diff --git a/exercises/1901100275/README.md b/exercises/1901100275/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/exercises/1901100275/ni.py b/exercises/1901100275/ni.py deleted file mode 100644 index 8eb74cf27..000000000 --- a/exercises/1901100275/ni.py +++ /dev/null @@ -1 +0,0 @@ -print('Hello world') \ No newline at end of file diff --git a/exercises/1901100276/d07/main.py b/exercises/1901100276/d07/main.py deleted file mode 100644 index 32e1465bf..000000000 --- a/exercises/1901100276/d07/main.py +++ /dev/null @@ -1,63 +0,0 @@ -from mymodule import stats_word -text = ''' -愚 公 移 ⼭ -太 ⾏,王 屋 ⼆ ⼭ 的 北 ⾯ , 住 了 ⼀ 個 九 ⼗ 歲 的 ⽼ 翁 , 名 叫 愚 公 。 ⼆ ⼭ 佔 地 廣 闊 , 擋 住 去 路 , 使 他 -和 家 ⼈ 往 來 極 為 不 便 。 -⼀ 天 , 愚 公 召 集 家 ⼈ 說 : 「 讓 我 們 各 盡 其 ⼒ , 剷 平 ⼆ ⼭ , 開 條 道 路 , 直 通 豫 州 , 你 們 認 為 怎 -樣 ?」 -⼤ 家 都 異 ⼝ 同 聲 贊 成 , 只 有 他 的 妻 ⼦ 表 示 懷 疑 , 並 說 : 「 你 連 開 鑿 ⼀ 個 ⼩ 丘 的 ⼒ 量 都 沒 有 ,怎 -可 能 剷 平 太 ⾏ 、 王 屋 ⼆ ⼭ 呢 ? 況 且 , 鑿 出 的 ⼟ ⽯ ⼜ 丟 到 哪 裏 去 呢 ?」 -⼤ 家 都 熱 烈 地 說 : 「 把 ⼟ ⽯ 丟 進 渤 海 裏 。」 -於 是 愚 公 就 和 兒 孫 , ⼀ 起 開 挖 ⼟ , 把 ⼟ ⽯ 搬 運 到 渤 海 去。 -愚 公 的 鄰 居 是 個 寡 婦 , 有 個 兒 ⼦ ⼋ 歲 也 興 致 勃 勃 地⾛ 來 幫 忙。 -寒 來 暑 往 , 他 們 要 ⼀ 年 才 能 往 返 渤 海 ⼀ 次 。 -住 在 ⿈ 河 河 畔 的 智 叟 , 看 ⾒ 他 們 這 樣 ⾟ 苦 , 取 笑 愚 公 說 :「你 不 是 很 愚 蠢 嗎 ? 你 已 ⼀ 把 年 紀 -了 , 就 是 ⽤ 盡 你 的 氣 ⼒ , 也 不 能 挖 去 ⼭ 的 ⼀ ⻆ 呢 ? 」 -愚 公 歎 息 道 : 「 你 有 這 樣 的 成 ⾒ , 是 不 會 明 ⽩ 的 。 你 ⽐ 那 寡 婦 的 ⼩ 兒 ⼦ 還 不 如 呢 ! 就 算 我 死 -了 , 還 有 我 的 兒 ⼦ , 我 的 孫 ⼦ , 我 的 曾 孫 ⼦ ,他 們 ⼀ 直 傳 下 去 。 ⽽ 這 ⼆ ⼭ 是 不 會 加 ⼤ 的 , 總 有 -⼀ 天 , 我 們 會 把 它 們 剷 平 。 」 -智 叟 聽 了 , 無 話 可 說 : -⼆ ⼭ 的 守 護 神 被 愚 公 的 堅 毅 精 神 嚇 倒 , 便 把 此 事 奏 知 天 帝。天 帝 佩 服 愚 公 的 精 神 , 就 命 兩 位 ⼤ -⼒ 神 揹 ⾛ ⼆ ⼭ 。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' -a= stats_word.stats_text(text) -print(a) \ No newline at end of file diff --git a/exercises/1901100276/d07/mymodule/stats_word.py b/exercises/1901100276/d07/mymodule/stats_word.py deleted file mode 100644 index 555b78934..000000000 --- a/exercises/1901100276/d07/mymodule/stats_word.py +++ /dev/null @@ -1,54 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -def stats_text_en(text): #定义函数 - a=text.replace('-','').replace('*','') #把括号中的'-'替换成‘’,相当于删除 - d=a.split() #分隔 - w={} #创建空列表 - for i in d: - c=d.count(i) #统计d里面的单词次数 - n={i:c} - w.update(n) #把n里的单词添加到w里 - m=sorted(w.items(),key=lambda x:x[1],reverse=True)#排序 - return m -stats_text_en(text)#调用函数 -text=''' -如 果 有 关 某 事 的 细 节 能 契 合 到 人 们 对 此 事 认 知 的 心 理 图 景 之 中 -那 么 描 述 中 的 细 节 越 多 -它 看 来 就 越 真 实 -而 人 们 也 就 会 认 为 它 越 可 能 发 生 — — 尽 管 任 何 不 确 定 性 细 节 的 加 入 -都 只 会 使 总 的 复 合 描 述 变 得 更 不 可 能 -''' -def stats_text_cn(text): #定义函数 - g=text.replace('-','').replace('*','') #把括号中的'-'替换成‘’,相当于删除 - l=g.split() #分隔 - m={} #创建空列表 - for j in l: - p=l.count(j) #统计l里面的单词次数 - k={j:p} - m.update(k) #把k里的单词添加到m里 - t=sorted(m.items(),key=lambda x:x[1],reverse=True)#排序 - return t -stats_text_cn(text) -def stats_text(text):#合并词频统计结果 - return stats_text_en(text) + stats_text_cn(text) \ No newline at end of file diff --git a/exercises/1901100276/d08/main.py b/exercises/1901100276/d08/main.py deleted file mode 100644 index ffc370c39..000000000 --- a/exercises/1901100276/d08/main.py +++ /dev/null @@ -1,67 +0,0 @@ -from mymodule import stats_word -text = ''' -愚 公 移 ⼭ -太 ⾏,王 屋 ⼆ ⼭ 的 北 ⾯ , 住 了 ⼀ 個 九 ⼗ 歲 的 ⽼ 翁 , 名 叫 愚 公 。 ⼆ ⼭ 佔 地 廣 闊 , 擋 住 去 路 , 使 他 -和 家 ⼈ 往 來 極 為 不 便 。 -⼀ 天 , 愚 公 召 集 家 ⼈ 說 : 「 讓 我 們 各 盡 其 ⼒ , 剷 平 ⼆ ⼭ , 開 條 道 路 , 直 通 豫 州 , 你 們 認 為 怎 -樣 ?」 -⼤ 家 都 異 ⼝ 同 聲 贊 成 , 只 有 他 的 妻 ⼦ 表 示 懷 疑 , 並 說 : 「 你 連 開 鑿 ⼀ 個 ⼩ 丘 的 ⼒ 量 都 沒 有 ,怎 -可 能 剷 平 太 ⾏ 、 王 屋 ⼆ ⼭ 呢 ? 況 且 , 鑿 出 的 ⼟ ⽯ ⼜ 丟 到 哪 裏 去 呢 ?」 -⼤ 家 都 熱 烈 地 說 : 「 把 ⼟ ⽯ 丟 進 渤 海 裏 。」 -於 是 愚 公 就 和 兒 孫 , ⼀ 起 開 挖 ⼟ , 把 ⼟ ⽯ 搬 運 到 渤 海 去。 -愚 公 的 鄰 居 是 個 寡 婦 , 有 個 兒 ⼦ ⼋ 歲 也 興 致 勃 勃 地⾛ 來 幫 忙。 -寒 來 暑 往 , 他 們 要 ⼀ 年 才 能 往 返 渤 海 ⼀ 次 。 -住 在 ⿈ 河 河 畔 的 智 叟 , 看 ⾒ 他 們 這 樣 ⾟ 苦 , 取 笑 愚 公 說 :「你 不 是 很 愚 蠢 嗎 ? 你 已 ⼀ 把 年 紀 -了 , 就 是 ⽤ 盡 你 的 氣 ⼒ , 也 不 能 挖 去 ⼭ 的 ⼀ ⻆ 呢 ? 」 -愚 公 歎 息 道 : 「 你 有 這 樣 的 成 ⾒ , 是 不 會 明 ⽩ 的 。 你 ⽐ 那 寡 婦 的 ⼩ 兒 ⼦ 還 不 如 呢 ! 就 算 我 死 -了 , 還 有 我 的 兒 ⼦ , 我 的 孫 ⼦ , 我 的 曾 孫 ⼦ ,他 們 ⼀ 直 傳 下 去 。 ⽽ 這 ⼆ ⼭ 是 不 會 加 ⼤ 的 , 總 有 -⼀ 天 , 我 們 會 把 它 們 剷 平 。 」 -智 叟 聽 了 , 無 話 可 說 : -⼆ ⼭ 的 守 護 神 被 愚 公 的 堅 毅 精 神 嚇 倒 , 便 把 此 事 奏 知 天 帝。天 帝 佩 服 愚 公 的 精 神 , 就 命 兩 位 ⼤ -⼒ 神 揹 ⾛ ⼆ ⼭ 。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' -a= stats_word.stats_text(text) -print(a) -try: - a= stats_word.stats_text([]) -except ValueError as e: - print('报错:{0}\n',format(e)) \ No newline at end of file diff --git a/exercises/1901100276/d08/mymodule/stats_word.py b/exercises/1901100276/d08/mymodule/stats_word.py deleted file mode 100644 index d79a4f6d7..000000000 --- a/exercises/1901100276/d08/mymodule/stats_word.py +++ /dev/null @@ -1,61 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -def stats_text_en(text): #定义函数 - if not isinstance(text,str): - raise ValueError('字符串必须是str类型) - a=text.replace('-','').replace('*','') #把括号中的'-'替换成‘’,相当于删除 - d=a.split() #分隔 - w={} #创建空列表 - for i in d: - c=d.count(i) #统计d里面的单词次数 - n={i:c} - w.update(n) #把n里的单词添加到w里 - m=sorted(w.items(),key=lambda x:x[1],reverse=True)#排序 - return m -stats_text_en(text)#调用函数 -text=''' -如 果 有 关 某 事 的 细 节 能 契 合 到 人 们 对 此 事 认 知 的 心 理 图 景 之 中 -那 么 描 述 中 的 细 节 越 多 -它 看 来 就 越 真 实 -而 人 们 也 就 会 认 为 它 越 可 能 发 生 — — 尽 管 任 何 不 确 定 性 细 节 的 加 入 -都 只 会 使 总 的 复 合 描 述 变 得 更 不 可 能 -''' -def stats_text_cn(text): #定义函数 - if not isinstance(text,str): #引发异常 - raise ValueError('字符串必须是str类型' ) - g=text.replace('-','').replace('*','') #把括号中的'-'替换成‘’,相当于删除 - l=g.split() #分隔 - m={} #创建空列表 - for j in l: - p=l.count(j) #统计l里面的单词次数 - k={j:p} - m.update(k) #把k里的单词添加到m里 - t=sorted(m.items(),key=lambda x:x[1],reverse=True) #排序 - return t -stats_text_cn(text) -def stats_text(text): #合并词频统计结果 - if not isinstance(text,str): #引发异常 - raise ValueError('字符串必须是str类型') - return stats_text_en(text) + stats_text_cn(text) -#stats_text_cn(1)#验证参数检查功能是否⽣效 diff --git a/exercises/1901100276/d09/main.py b/exercises/1901100276/d09/main.py deleted file mode 100644 index f7d1bd7ef..000000000 --- a/exercises/1901100276/d09/main.py +++ /dev/null @@ -1,71 +0,0 @@ -from mymodule import stats_word -text = ''' -愚 公 移 ⼭ -太 ⾏,王 屋 ⼆ ⼭ 的 北 ⾯ , 住 了 ⼀ 個 九 ⼗ 歲 的 ⽼ 翁 , 名 叫 愚 公 。 ⼆ ⼭ 佔 地 廣 闊 , 擋 住 去 路 , 使 他 -和 家 ⼈ 往 來 極 為 不 便 。 -⼀ 天 , 愚 公 召 集 家 ⼈ 說 : 「 讓 我 們 各 盡 其 ⼒ , 剷 平 ⼆ ⼭ , 開 條 道 路 , 直 通 豫 州 , 你 們 認 為 怎 -樣 ?」 -⼤ 家 都 異 ⼝ 同 聲 贊 成 , 只 有 他 的 妻 ⼦ 表 示 懷 疑 , 並 說 : 「 你 連 開 鑿 ⼀ 個 ⼩ 丘 的 ⼒ 量 都 沒 有 ,怎 -可 能 剷 平 太 ⾏ 、 王 屋 ⼆ ⼭ 呢 ? 況 且 , 鑿 出 的 ⼟ ⽯ ⼜ 丟 到 哪 裏 去 呢 ?」 -⼤ 家 都 熱 烈 地 說 : 「 把 ⼟ ⽯ 丟 進 渤 海 裏 。」 -於 是 愚 公 就 和 兒 孫 , ⼀ 起 開 挖 ⼟ , 把 ⼟ ⽯ 搬 運 到 渤 海 去。 -愚 公 的 鄰 居 是 個 寡 婦 , 有 個 兒 ⼦ ⼋ 歲 也 興 致 勃 勃 地⾛ 來 幫 忙。 -寒 來 暑 往 , 他 們 要 ⼀ 年 才 能 往 返 渤 海 ⼀ 次 。 -住 在 ⿈ 河 河 畔 的 智 叟 , 看 ⾒ 他 們 這 樣 ⾟ 苦 , 取 笑 愚 公 說 :「你 不 是 很 愚 蠢 嗎 ? 你 已 ⼀ 把 年 紀 -了 , 就 是 ⽤ 盡 你 的 氣 ⼒ , 也 不 能 挖 去 ⼭ 的 ⼀ ⻆ 呢 ? 」 -愚 公 歎 息 道 : 「 你 有 這 樣 的 成 ⾒ , 是 不 會 明 ⽩ 的 。 你 ⽐ 那 寡 婦 的 ⼩ 兒 ⼦ 還 不 如 呢 ! 就 算 我 死 -了 , 還 有 我 的 兒 ⼦ , 我 的 孫 ⼦ , 我 的 曾 孫 ⼦ ,他 們 ⼀ 直 傳 下 去 。 ⽽ 這 ⼆ ⼭ 是 不 會 加 ⼤ 的 , 總 有 -⼀ 天 , 我 們 會 把 它 們 剷 平 。 」 -智 叟 聽 了 , 無 話 可 說 : -⼆ ⼭ 的 守 護 神 被 愚 公 的 堅 毅 精 神 嚇 倒 , 便 把 此 事 奏 知 天 帝。天 帝 佩 服 愚 公 的 精 神 , 就 命 兩 位 ⼤ -⼒ 神 揹 ⾛ ⼆ ⼭ 。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' -with open(r'C:\Users\Administrator.PC-201904091527\Documents\GitHub\selfteaching-python-camp\exercises\1901100276\d09\mymodule\tang300.json','r',encoding='UTF-8')as f: - b= f.read() -#a= stats_word.stats_text(text) -#print(a) -def main(): - try: - print (stats_word.stats_text(b,100)) - except ValueError as e: - print('报错:{0}\n',format(e)) -main() \ No newline at end of file diff --git a/exercises/1901100276/d09/mymodule/stats_word.py b/exercises/1901100276/d09/mymodule/stats_word.py deleted file mode 100644 index 442fd7d93..000000000 --- a/exercises/1901100276/d09/mymodule/stats_word.py +++ /dev/null @@ -1,64 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -from collections import Counter -def stats_text_en(text,Count): #定义函数 - if not isinstance(text,str): - raise ValueError('字符串必须是str类型') - a=text.replace('-','').replace('*','') #把括号中的'-'替换成‘’,相当于删除 - d=a.split() #分隔 - w={} #创建空列表 - for i in d: - c=d.count(i) #统计d里面的单词次数 - n={i:c} - w.update(n) #把n里的单词添加到w里 -#m=sorted(w.items(),key=lambda x:x[1],reverse=True)#排序 - #return m - return Counter(w).most_common(Count) -#stats_text_en(text,Count)#调用函数 -text=''' -如 果 有 关 某 事 的 细 节 能 契 合 到 人 们 对 此 事 认 知 的 心 理 图 景 之 中 -那 么 描 述 中 的 细 节 越 多 -它 看 来 就 越 真 实 -而 人 们 也 就 会 认 为 它 越 可 能 发 生 — — 尽 管 任 何 不 确 定 性 细 节 的 加 入 -都 只 会 使 总 的 复 合 描 述 变 得 更 不 可 能 -''' -def stats_text_cn(text,Count): #定义函数 - if not isinstance(text,str): #引发异常 - raise ValueError('字符串必须是str类型' ) - g=text.replace('-','').replace('*','') #把括号中的'-'替换成‘’,相当于删除 - l=g.split() #分隔 - m={} #创建空列表 - for j in l: - p=l.count(j) #统计l里面的单词次数 - k={j:p} - m.update(k) #把k里的单词添加到m里 - #t=sorted(m.items(),key=lambda x:x[1],reverse=True) #排序 - #return t - return Counter(m).most_common(Count) -#stats_text_cn(text) -def stats_text(text,Count): #合并词频统计结果 - if not isinstance(text,str): #引发异常 - raise ValueError('字符串必须是str类型') - return stats_text_en(text,Count) + stats_text_cn(text,Count) -#stats_text_cn(1)#验证参数检查功能是否⽣效 diff --git a/exercises/1901100277/Day 07/main.py b/exercises/1901100277/Day 07/main.py index 722dcfa77..c79f0a59e 100644 --- a/exercises/1901100277/Day 07/main.py +++ b/exercises/1901100277/Day 07/main.py @@ -4,5 +4,5 @@ AAA = stats_word.stats_text(string) - print("统计 英文单词字频 和中文字频 的结果,并按从大到小排列:",AAA) + diff --git a/exercises/1901100277/Day 08/main.py b/exercises/1901100277/Day 08/main.py deleted file mode 100644 index 6095cfb40..000000000 --- a/exercises/1901100277/Day 08/main.py +++ /dev/null @@ -1,13 +0,0 @@ -from mymodule import stats_word - -string = 123456789 -try: - stats_word.stats_text(string) -except ValueError as error: - print(error) - -AAA = stats_word.stats_text(string) -print("统计 英文单词字频 和中文字频 的结果,并按从大到小排列:",AAA) - - - diff --git a/exercises/1901100277/Day 08/mymodule/stats_word.py b/exercises/1901100277/Day 08/mymodule/stats_word.py deleted file mode 100644 index 2fd87d1a8..000000000 --- a/exercises/1901100277/Day 08/mymodule/stats_word.py +++ /dev/null @@ -1,128 +0,0 @@ - - - -def stats_text_en (en_text) : - ''' 统计参数中每个英文单词出现的次数,最后返回一个按词频降序排列的数组''' - - #如果不是字符串,抛异常,异常会终止代码执行 - if not isinstance(en_text, str): - raise ValueError("非字符串格式,请重新输入") - - # text = str(en_text) - new = en_text.split(" ") #分割字符串,变为列表,以空格进行分割 - - words = [] - - - symbols = ",.*-!@\n" # 经过观察里面 有这几种符号 需要剔除 - - for new1 in new : # 遍历首次分割后单词 - - for symbol in symbols : # 遍历要剔除的符号 - new1 = new1.replace(symbol,"") # 如果粗糙单词里有这个符号,就将符号 替换为空 - if len(new1) >0 : # 替换后如果 元素长度大于零,说明是有效单词 - words.append(new1) # 把他添加到words 列表里 - # print("去除各种符号后 有效的单词 为这些>>>:",words) - - - # print("统计单词出现次数:") - d ={} #定义一个空字典,这里要用大括号 - - for i in words : - j= words.count(i) # 一个元素出现的: 次数 ,此处的i 就表示一个单词,上面已经分割好;另外用法 也可以是一个字符串中的 某一个或者几个字母,比如 'ea' - d[i] = j # 这里就是把这个单词 和 出现的次数 添加到 字典中,当然也可以用 update 函数 - - # print(d) - - # print("将单词 按出现频次数从大到小输出:") - # sorted 函数 排序:https://docs.python.org/zh-cn/3/howto/sorting.html#sortinghowto - d1=sorted(d.items(),key=lambda x:x[1],reverse=True) - return d1 - - - - -################################################################################ -################################################################################ - -# 统计参数中每个中文汉字出现的次数,最后返回一个按字频降序排列的数组 - -def stats_text_cn (cn_text) : - ''' 统计参数中每个汉字出现的次数,最后返回一个按词频降序排列的数组''' - - #如果不是字符串,抛异常,异常会终止代码执行 - if not isinstance(cn_text, str): - raise ValueError("非字符串格式,请重新输入") - - # text = str(cn_text) - # new = list (text) #汉字 字符串可以直接用 list 转化为 单个文字的列表. - - words = [] # 定义一个新列表,存储去掉符号后的新列表 - - symbols = "!?。"#$%&' ()*+,-/:;<=>@[\]^_`{|}~⦅⦆「」、、〃》「」『』【】〔〕〖〗〘〙〚〛〜〝〞〟〰〾〿–—‘’‛“”„‟…‧﹏." - - for wen_zi in cn_text : # i 就是文章里的某个元素 - if "\u4e00" <= wen_zi <= "\u9fff" : # unicode 中 中文字符的 范围 (包括中文标点符号) 如果元素是中文 - for symbol in symbols : # 遍历要剔除的标点符号 - wen_zi1 = wen_zi.replace(symbol,"") - words.append(wen_zi1) # 把他添加到words 列表里 - - - # print("去除各种符号后 有效的中文 文字>>>:",words) - - # print("统计单个文字出现次数:") - - d ={} - for i in words : - j= words.count(i) # 一个元素出现的: 次数 ,此处的i 就表示一个单词,上面已经分割好;另外用法 也可以是一个字符串中的 某一个或者几个字母,比如 'ea' - d[i] = j # 这里就是把这个单词 和 出现的次数 添加到 字典中,当然也可以用 update 函数 - - - # print(d) - - # print("将文字 按出现频次数从大到小输出:") - - - ################################################# - # sorted 函数 排序:https://docs.python.org/zh-cn/3/howto/sorting.html#sortinghowto - # 敲重点: lambda 是一个匿名函数,https://www.bilibili.com/video/av40153579/?p=13 - # key=lambda 元素: 元素[字段索引] https://blog.csdn.net/u010758410/article/details/79737498 - # 0:代表按照第一个字段索引,1:代表按照第二个字段索引,比如下面的1 就是按照 单词的频率 进行索引排序 - ################################################# - - d1=sorted(d.items(),key=lambda x:x[1],reverse=True) - return d1 - - -def stats_text(string): - ''' - 统计 英文单词字频 和中文字频 的结果,并按从大到小排列 - ''' - - #如果不是字符串,抛异常,异常会终止代码执行 - if not isinstance(string, str): - raise ValueError("非字符串格式,请重新输入") - - - return stats_text_en(en_text) + stats_text_cn(cn_text) - -cn_text = "测试:今天是个好日子,好日子 126456220600 ,心想的事儿都能成,哈哈哈,都能成#$%&'()*+,-/" # 中文文字 - -en_text = "the hao de wo kan xing xing wo wo @" # 需要处理的英文单词 - -string = " 测试:今天是个好日子,好日子 126456220600 ,心想的事儿都能成,哈哈哈,都能成#$%&'()*+,-/, the hao de wo kan xing xing wo wo @" - - -#搜索_name_ = _main_ -#一般情况下在文件内测试代码的时候以下面的形式进行 -if __name__ == "__main__" : - # en_result = stats_text_en(en_text) - # cn_result = stats_text_cn(cn_text) - - # print("统计参数中每个英文单词出现的次数=>\n",en_result) - # print("统计参数中每个中文汉字出现的次数=>\n",cn_result) - - print(stats_text(string)) - - - diff --git a/exercises/1901100277/Day 9/main.py b/exercises/1901100277/Day 9/main.py deleted file mode 100644 index 73fc3628c..000000000 --- a/exercises/1901100277/Day 9/main.py +++ /dev/null @@ -1,24 +0,0 @@ -from mymodule import stats_word -import json - - -# string = 123456789 -# try: -# stats_word.stats_text(string) -# except ValueError as error: -# print(error) - - -#读取本地文件,进行词频统计 - -with open(r'E:\xuefeng\selfteaching-python-camp\exercises\1901100277\Day 09\mymodule\tang300.json', 'r',encoding='utf-8') as f: - # https://www.liaoxuefeng.com/wiki/1016959663602400/1017607179232640 廖雪峰:文件的读写 - - cn_text = f.read() # 读取文件全部内容 - - -print(stats_word.stats_text_cn(cn_text)) - - - - diff --git a/exercises/1901100277/Day 9/mymodule/stats_word.py b/exercises/1901100277/Day 9/mymodule/stats_word.py deleted file mode 100644 index 460e46834..000000000 --- a/exercises/1901100277/Day 9/mymodule/stats_word.py +++ /dev/null @@ -1,75 +0,0 @@ - -def stats_text_en (en_text) : - ''' 统计参数中每个英文单词出现的次数,最后返回一个按词频降序排列的数组''' - - #如果不是字符串,抛异常,异常会终止代码执行 - if not isinstance(en_text, str): - raise ValueError("非字符串格式,请重新输入") - - new = en_text.split(" ") #分割字符串,变为列表,以空格进行分割 - - words = [] - - symbols = ",.*-!@\n" - - for new1 in new : # 遍历首次分割后单词 - - for symbol in symbols : # 遍历要剔除的符号 - new1 = new1.replace(symbol,"") # 如果粗糙单词里有这个符号,就将符号 替换为空 - if len(new1) >0 : # 替换后如果 元素长度大于零,说明是有效单词 - words.append(new1) # 把他添加到words 列表里 - - - # 使用 collections 模块里的 counter函数 进行词频统计 - - from collections import Counter - n = int(input("请输入 您需要显示出现词频最高的前多少个词? >>> :")) - return dict(Counter(words).most_common(n)) - - -################################################################################ -################################################################################ - -# 统计参数中每个中文汉字出现的次数,最后返回一个按字频降序排列的数组 - -def stats_text_cn (cn_text) : - ''' 统计参数中每个汉字出现的次数,最后返回一个按词频降序排列的数组''' - - #如果不是字符串,抛异常,异常会终止代码执行 - if not isinstance(cn_text, str): - raise ValueError("非字符串格式,请重新输入") - - # text = str(cn_text) - # new = list (text) #汉字 字符串可以直接用 list 转化为 单个文字的列表. - - words = [] # 定义一个新列表,存储去掉符号后的新列表 - - symbols = "!?。"#$%&' ()*+,-/:;<=>@[\]^_`{|}~⦅⦆「」、、〃》「」『』【】〔〕〖〗〘〙〚〛〜〝〞〟〰〾〿–—‘’‛“”„‟…‧﹏." - - for wen_zi in cn_text : # i 就是文章里的某个元素 - if "\u4e00" <= wen_zi <= "\u9fff" : # unicode 中 中文字符的 范围 (包括中文标点符号) 如果元素是中文 - for symbol in symbols : # 遍历要剔除的标点符号 - wen_zi1 = wen_zi.replace(symbol,"") - words.append(wen_zi1) # 把他添加到words 列表里 - - from collections import Counter - n = int(input("请输入 您需要显示出现词频最高的前多少个词? >>> :")) - return dict(Counter(words).most_common(n)) - - ################################################# - -def stats_text(string): - ''' - 统计 英文单词字频 和中文字频 的结果,并按从大到小排列 - ''' - - #如果不是字符串,抛异常,异常会终止代码执行 - if not isinstance(string, str): - raise ValueError("非字符串格式,请重新输入") - - return stats_text_en(en_text) + stats_text_cn(cn_text) - - - - - diff --git a/exercises/1901100282/1001S02E01_helloworld.txt.txt b/exercises/1901100282/1001S02E01_helloworld.txt.txt deleted file mode 100644 index 7946b9ceb..000000000 --- a/exercises/1901100282/1001S02E01_helloworld.txt.txt +++ /dev/null @@ -1 +0,0 @@ -first try diff --git a/exercises/1901100282/190110282_hello_python.py.py b/exercises/1901100282/190110282_hello_python.py.py deleted file mode 100644 index 2e910fb54..000000000 --- a/exercises/1901100282/190110282_hello_python.py.py +++ /dev/null @@ -1 +0,0 @@ -print ('hello world') \ No newline at end of file diff --git a/exercises/1901100282/README.md b/exercises/1901100282/README.md deleted file mode 100644 index 93a078d1c..000000000 --- a/exercises/1901100282/README.md +++ /dev/null @@ -1 +0,0 @@ -# hello-world \ No newline at end of file diff --git a/exercises/1901100283/README.md b/exercises/1901100283/README.md index 42b3dc5dd..e69de29bb 100644 --- a/exercises/1901100283/README.md +++ b/exercises/1901100283/README.md @@ -1,24 +0,0 @@ - -### 自学训练营-Python14天入门总结 -#### 怎么会上这门课? -我在2018年一次偶然的网课上知道了Python,深度学习等概念。后面前后两次在网上学习Python,要么感觉和我想学的方向不是很相关,要么就是只有实操,没有系统性,所以最终都是中途果断放弃。 - -在2019年的某个读书会上主办人分享了《财富自由之路》这本书,并且提到已经读过好几遍,每次复盘都有很大收获。我想一本书值得读上好几遍必定是本好书,所以果断也买来阅读,没想到自从看了这本书就感觉停不下来,一遍又一遍,目前在看第四遍。我想如果能把这本书中的每一点都自己亲自去实践那必定会是一个非常了不起的个人成长。看完这本书后很自然的关注了李笑来老师的几个公众号。后来发现有李老师组织的Python编程课程,不过价格不菲。当时就知道学习Python还有这个渠道,由于价格较贵,没有立即报名参加。 - -2019年8月8日,和我所在公司的一位设计工程师沟通有关Python,他说最近接触校企合作的学习Python方向的大学毕业生刚毕业就找了非常好的公司,而且月薪有28000元一个月。这个消息我感到太震惊了!我工作了10多年离这个工资水平还很远,一个大学毕业生就有这么高工资,这和所选行业、专业有非常大的关系。而且未来的趋势大家都知道是人工智能、深度学习、大数据方向。既然如此,还有什么理由不早点学习相关技能为将来做准备呢?这一天,我果断报名了“Python14天入门”总费用2000多元的课程,这也是第一次报这么贵的网课。一路走来,感觉最重要的真的是如何赋予一件事情非常重大的意义,让自己觉得不做不行,而且要有谁拦着我不让做我就跟谁急,停不下来的感觉。 - -#### 自学的理解和感悟 -这门课程和其它网课很不同点在于它真的带你入门了,我总结了四点最少必要知识:1、Github协作平台 2、Anaconda环境管理器 3、编程基本语法 4、第三方库。 - -整个课程的设置融入李老师《财富》中写的如何自学的一整套方法。每天作业中的参考资料就是自学内容,需要提交的作业就是实践内容,学习笔记是自己的总结与复盘,完成作业后的视频资料是再次学习和比对的过程,钉钉群是一个学习社区,相当于营造一个学习的社交环境,教练就是自学领域的高人,有什么问题可以直接请教。这个课程设置的非常棒!让我再一次有幸亲身体验自学的这一整套方法。 - -有关Python编程我总结了以下几点感悟: -1. 编程是非常严谨的一门学问。即使相差一个标点符号,或者大小写搞错都不行,容不下一点小错误。这就要求学习编程的人尤其仔细和耐心。真心觉得每个人都应该学习编程这门课程。 -2. 碰到问题首先自己上网找答案。整个自学过程经常碰到各种各样的问题,第一步就是自己先网上找答案,还要给自己一个限定的时间,如果这段时间内自己都不能解决问题,那就可以找相关的人帮忙解答。 -3. 概念要清晰。编程会碰到很多新知识点,对于门外汉来说基本上每一个都是新知识点,在学习时第一步就是概念要清晰,否则编程思路就会不清楚。 -4. 同一个问题可以有多种解决思路。在看到问题后第一时间想尽可能多的解决思路,选择一种思路开始编程后,若中途碰到困难自己实在无法解决时,还可以尝试其他的解决思路编程。 -5. 编程非常锻炼逻辑能力。在编程时逻辑也是非常讲究,而且一定要非常清晰。否则编程的过程中会走很多弯路。 -6. 不要以为那和自己无关。每次作业完成后都有视频讲解,每次我也都会看,但是看完后我基本没有对自己原先的作业修改过,因为觉得自己那样写代码也完成作业了。直到某一天作业中调用模块时出问题了,而解决方法在视频讲解中提到不止一次,而我当下却想不起来,后来请教教练后才突然醒悟。这是多么恐怖的一件事,就因为我那种和自己无关的想法居然活生生的错过了好几次学习某个代码的机会! - -这是一次非常珍贵的自学经历。非常感谢李笑来老师,感谢教练以及曾经帮助过我的同学们!我还会在自己感兴趣的Python方向上继续前行! - diff --git a/exercises/1901100283/d11/mymodule/main.py b/exercises/1901100283/d11/mymodule/main.py deleted file mode 100644 index 82eb80e0c..000000000 --- a/exercises/1901100283/d11/mymodule/main.py +++ /dev/null @@ -1,6 +0,0 @@ -from stats_word import stats_text -text=123 -try: - print(stats_text(text)) -except ValueError: - print('请重新输入字符串内容!') \ No newline at end of file diff --git a/exercises/1901100283/d11/mymodule/stats_word.py b/exercises/1901100283/d11/mymodule/stats_word.py deleted file mode 100644 index 78616ae27..000000000 --- a/exercises/1901100283/d11/mymodule/stats_word.py +++ /dev/null @@ -1,54 +0,0 @@ -#stats_text_en 封装统计英文单词词频的函数 -def stats_text_en(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - else: - pass - a=text.split() - x=[] - for i in a: - if i.isalpha() is True: - x.append(i) - from collections import Counter - n=int(input('请输入您需要的词频最高的前n个词的具体数值:')) - return dict(Counter(x).most_common(n)) - -#stats_text_cn 封装统计中文汉字字频的函数 -import jieba -def stats_text_cn(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - seg_list=jieba.lcut(text) - x=[] - for i in seg_list: - if '\u4e00'<=i<='\u9fa5' and len(i)>=2: - x.append(i) - from collections import Counter - return dict(Counter(x).most_common(100)) - -#stats_text 分别调用stats_text_en , stats_text_cn ,输出合并词频统计结果 -def stats_text(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - new_dic=dict(stats_text_en(text),**stats_text_cn(text)) - return new_dic - -#通过网络请求获得网页内容,使⽤分词工具对中文字符串进行分词,统计词频,得出结果,发送给到指定的邮箱 -import getpass -sender=input('请输入发件人邮箱:') -password=getpass.getpass('输入发件人邮箱密码(可复制粘贴):') -recipient=input('请输入收件人邮箱:') - -import requests -response=requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') -from pyquery import PyQuery -document=PyQuery(response.text) -content=document('#js_content').text() -body=str(stats_text_cn(content)) - -import yagmail -yag=yagmail.SMTP(sender,password,'smtp.126.com') -yag.send(recipient,'1901100283 自学训练营学习19群 Day11 PerryZ10',body) \ No newline at end of file diff --git a/exercises/1901100283/d12/mymodule/main.py b/exercises/1901100283/d12/mymodule/main.py deleted file mode 100644 index 0713aae2e..000000000 --- a/exercises/1901100283/d12/mymodule/main.py +++ /dev/null @@ -1,16 +0,0 @@ -#将实战项⽬目1的功能包装集成到个⼈人微信 -from wxpy import * -bot = Bot() -my_friend=bot.friends() -@bot.register(my_friend,SHARING) -def get_friend_url(msg): - if isinstance(msg.type,SHARING): - import requests - response=requests.get(msg.url) - from pyquery import PyQuery - document=PyQuery(response.text) - content=document('#js_content').text() - from stats_word import stats_text_cn - body=str(stats_text_cn(content)) - msg.reply(body) -embed() \ No newline at end of file diff --git a/exercises/1901100283/d12/mymodule/stats_word.py b/exercises/1901100283/d12/mymodule/stats_word.py deleted file mode 100644 index 78616ae27..000000000 --- a/exercises/1901100283/d12/mymodule/stats_word.py +++ /dev/null @@ -1,54 +0,0 @@ -#stats_text_en 封装统计英文单词词频的函数 -def stats_text_en(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - else: - pass - a=text.split() - x=[] - for i in a: - if i.isalpha() is True: - x.append(i) - from collections import Counter - n=int(input('请输入您需要的词频最高的前n个词的具体数值:')) - return dict(Counter(x).most_common(n)) - -#stats_text_cn 封装统计中文汉字字频的函数 -import jieba -def stats_text_cn(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - seg_list=jieba.lcut(text) - x=[] - for i in seg_list: - if '\u4e00'<=i<='\u9fa5' and len(i)>=2: - x.append(i) - from collections import Counter - return dict(Counter(x).most_common(100)) - -#stats_text 分别调用stats_text_en , stats_text_cn ,输出合并词频统计结果 -def stats_text(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - new_dic=dict(stats_text_en(text),**stats_text_cn(text)) - return new_dic - -#通过网络请求获得网页内容,使⽤分词工具对中文字符串进行分词,统计词频,得出结果,发送给到指定的邮箱 -import getpass -sender=input('请输入发件人邮箱:') -password=getpass.getpass('输入发件人邮箱密码(可复制粘贴):') -recipient=input('请输入收件人邮箱:') - -import requests -response=requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') -from pyquery import PyQuery -document=PyQuery(response.text) -content=document('#js_content').text() -body=str(stats_text_cn(content)) - -import yagmail -yag=yagmail.SMTP(sender,password,'smtp.126.com') -yag.send(recipient,'1901100283 自学训练营学习19群 Day11 PerryZ10',body) \ No newline at end of file diff --git a/exercises/1901100283/d13/mymodule/main.py b/exercises/1901100283/d13/mymodule/main.py deleted file mode 100644 index 3cde393f9..000000000 --- a/exercises/1901100283/d13/mymodule/main.py +++ /dev/null @@ -1,48 +0,0 @@ -#将实战项⽬目1的功能包装集成到个⼈人微信 -'''from wxpy import * -bot = Bot() -my_friend=bot.friends() -@bot.register(my_friend,SHARING) -def get_friend_url(msg): - if isinstance(msg.type,SHARING): - import requests - response=requests.get(msg.url) - from pyquery import PyQuery - document=PyQuery(response.text) - content=document('#js_content').text() - from stats_word import stats_text_cn - body=str(stats_text_cn(content)) - msg.reply(body) -embed() -''' -#Day11作业转化成图表 -import requests -response=requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') -from pyquery import PyQuery -document=PyQuery(response.text) -content=document('#js_content').text() - -import numpy as np -import matplotlib.pyplot as plt -from matplotlib.ticker import FuncFormatter -from pylab import mpl -mpl.rcParams['font.sans-serif']=['Microsoft YaHei'] - -from stats_word import stats_text_cn -data=stats_text_cn(content) -group_data=list(data.values()) -group_names=list(data.keys()) - -plt.rcParams.update({'figure.autolayout':True}) -fig,ax=plt.subplots() -ax.barh(group_names,group_data) -plt.style.use('seaborn-paper') -labels=ax.get_xticklabels() -plt.setp(labels,horizontalalignment='right') -ax.set(xlabel='词频',ylabel='中文汉字',title='中文汉字词频统计') -plt.show() - - - - - diff --git a/exercises/1901100283/d13/mymodule/stats_word.py b/exercises/1901100283/d13/mymodule/stats_word.py deleted file mode 100644 index fbb009f6b..000000000 --- a/exercises/1901100283/d13/mymodule/stats_word.py +++ /dev/null @@ -1,55 +0,0 @@ -#stats_text_en 封装统计英文单词词频的函数 -def stats_text_en(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - else: - pass - a=text.split() - x=[] - for i in a: - if i.isalpha() is True: - x.append(i) - from collections import Counter - n=int(input('请输入您需要的词频最高的前n个词的具体数值:')) - return dict(Counter(x).most_common(n)) - -#stats_text_cn 封装统计中文汉字字频的函数 -import jieba -def stats_text_cn(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - seg_list=jieba.lcut(text) - x=[] - for i in seg_list: - if '\u4e00'<=i<='\u9fa5' and len(i)>=2: - x.append(i) - from collections import Counter - return dict(Counter(x).most_common(20)) - -#stats_text 分别调用stats_text_en , stats_text_cn ,输出合并词频统计结果 -def stats_text(text): - if isinstance(text,str) is False: - print('您输入的内容不是字符串类型!') - raise ValueError - new_dic=dict(stats_text_en(text),**stats_text_cn(text)) - return new_dic - -if __name__=='__main__': -#通过网络请求获得网页内容,使⽤分词工具对中文字符串进行分词,统计词频,得出结果,发送给到指定的邮箱 - import getpass - sender=input('请输入发件人邮箱:') - password=getpass.getpass('输入发件人邮箱密码(可复制粘贴):') - recipient=input('请输入收件人邮箱:') - - import requests - response=requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - from pyquery import PyQuery - document=PyQuery(response.text) - content=document('#js_content').text() - body=str(stats_text_cn(content)) - - import yagmail - yag=yagmail.SMTP(sender,password,'smtp.126.com') - yag.send(recipient,'1901100283 自学训练营学习19群 Day11 PerryZ10',body) \ No newline at end of file diff --git a/exercises/1901100290/1001S02E05_array.py b/exercises/1901100290/1001S02E05_array.py deleted file mode 100644 index 77e64667d..000000000 --- a/exercises/1901100290/1001S02E05_array.py +++ /dev/null @@ -1,38 +0,0 @@ - -# 翻转 - -p=[0,1,2,3,4,5,6,7,8,9] -p.reverse() -print(p) - - -#翻转后的数组拼接成字符串串 - -y = ''.join(str(i) for i in p) - - -#⽤用字符串串切⽚片的⽅方式取出第三到第⼋八个字符(包含第三和第⼋八个字符) - -a = y[2:8] - - -#将获得的字符串串进⾏行行翻转 - -c = a[::-1] - - -# 将结果转换为int类型 - -b = int(c) - - -# 分别转换成⼆二进制,⼋八进制,⼗十六进制 - -print('十进制整数为: ',b) -print('转换成二进制为: ',bin(b)) -print('转换成八进制为: ',oct(b)) -print('转换成十六进制为: ',hex(b)) - -int('b', 2) -int('b', 8) -int('b', 16) diff --git a/exercises/1901100290/1001S02E05_stats_text.py b/exercises/1901100290/1001S02E05_stats_text.py deleted file mode 100644 index bf7a4cac2..000000000 --- a/exercises/1901100290/1001S02E05_stats_text.py +++ /dev/null @@ -1,46 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - - - - - - -# 只统计英文单词,不包括非英文字符的其他任何符号,如连接符号、空白字符等等 -list1 = text.split( ) -i=0 -for i in range(0,len(list1)): - list1[i]=list1[i].strip('*-,.!') - if list1[i]==' ': - list1[i].remove(' ') - else: - i=i+1 -# 使用dict统计字符串样本中各个英文单词出现的次数 -# 按照出现次数从大到小排列,示例 {'is': 10, ‘better’ : 9, …… } -import collections -print(collections.Counter(list1)) - - - - diff --git a/exercises/1901100290/1001S02E05_string.py b/exercises/1901100290/1001S02E05_string.py deleted file mode 100644 index 784cb915a..000000000 --- a/exercises/1901100290/1001S02E05_string.py +++ /dev/null @@ -1,47 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -#1.将better替换为worse -s = text.replace('better','worse') -print(s) - - -#2.剔除含有ea的单词 -a="EA" -b=[] -for a in s: - if a.find(s)<0: - b.append(a) -print(s) - - -#3.大小写替换 -y=s.swapcase() -print(y) - - -#4.升序排列 -list1=y.split() -list1.sort() -print(list1) \ No newline at end of file diff --git a/exercises/1901100290/1001S02E06_stats_word.py b/exercises/1901100290/1001S02E06_stats_word.py deleted file mode 100644 index 59c7dc51e..000000000 --- a/exercises/1901100290/1001S02E06_stats_word.py +++ /dev/null @@ -1,97 +0,0 @@ -sample_text = ''' -The Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -elements=sample_text.split()#先将字符串根据空白字符分割成list,要调用str类型 -words=[]#定义一个新的list型变量,存储处理过的单词 -symbols=',.*-!'#针对文本筛选出需要剔除的非单词符号 - -for element in elements: - for symbol in symbols:#遍一遍需要剔除的符号 - element=element.replace(symbol,'')#逐个替换字符号,用‘’是为了同时剔除符号所占的位置 - if len(element): - words.append(element)#剔除了字符后如果element的长度不为0,则算作正常单词 -print('',words) - -counter = {}#初始化一个dict(字典)类型的变量,用来存放单词出现的次数 -word_set = set(words)#set(集合)类型可以去掉列表里的重复元素 -for word in word_set: - counter[word] = word.count(word) -print('',counter)#在for··in里减少循环次数 -print('',sorted(counter.items(),key=lambda x:x[1],reverse=True)) -#按照出现次数从大到小输出所有的单词及出现次数 -#内置函数sorted的参数key表示按元素的哪一项进行排序 -#dict类型counter的items方法会返回一个包含相应项(key,value)的元素列表 -#print('counter.items()‘,counter.items()) - -sample_text = ''' -The Zen of Python, by Tim Peters - -美 丽 优 于 丑 陋. -直 言 优 于 暗 示. -简 单 优 于 复 杂. -复 杂 优 于 难 懂. -平 直 优 于 曲 折. -疏 散 优 于 密 集. -重 在 重 读. -打 破 规 则 的 特 别 不 能 称 之 为 特 别. -尽 管 练 习 会 打 败 纯 粹. -错 误 不 应 该 无 声 的 过 去. -除 非 明 晰 沉 默. -直 面 拒 绝 猜 测. -这 将 只 有 一 个-- 完 美 的 仅 有 的 --显 然 易 见 的 路 去 做. -尽 管 那 条 路 一 开 始 并 不 明 显 除 非 你 延 展. -现 在 好 过 从 不. -尽 管 从 不 常 好 过 *对 的* 现 在. -如 果 执 行 很 难 解 释,那 也 许 是 坏 点 子. -如 果 执 行 很 易 解 释,那 也 许 是 好 点 子. -命 名 空 间 是 最 棒 的 想 法 -- 让 我 们 做 的 更 多! -''' - -elements=sample_text.split()#先将字符串根据空白字符分割成list,要调用str类型 -words=[]#定义一个新的list型变量,存储处理过的单词 -symbols=',.*-!'#针对文本筛选出需要剔除的非单词符号 - -for element in elements: - for symbol in symbols:#遍一遍需要剔除的符号 - element=element.replace(symbol,'')#逐个替换字符号,用‘’是为了同时剔除符号所占的位置 - if len(element): - words.append(element)#剔除了字符后如果element的长度不为0,则算作正常单词 -print('',words) - -counter = {}#初始化一个dict(字典)类型的变量,用来存放单词出现的次数 -word_set = set(words)#set(集合)类型可以去掉列表里的重复元素 -for word in word_set: - counter[word] = word.count(word) -print('',counter)#在for··in里减少循环次数 -print('',sorted(counter.items(),key=lambda x:x[1],reverse=True)) -#按照出现次数从大到小输出所有的单词及出现次数 -#内置函数sorted的参数key表示按元素的哪一项进行排序 -#dict类型counter的items方法会返回一个包含相应项(key,value)的元素列表 -#print('counter.items()‘,counter.items()) - - - - - - diff --git a/exercises/1901100293/1001S02E01_helloworld.txt b/exercises/1901100293/1001S02E01_helloworld.txt deleted file mode 100644 index 3b2bebcd4..000000000 --- a/exercises/1901100293/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -Im Seven diff --git a/exercises/1901100293/1001S02E02_hello_python.py b/exercises/1901100293/1001S02E02_hello_python.py deleted file mode 100644 index 73fb7c3fb..000000000 --- a/exercises/1901100293/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print('Hello World!') diff --git a/exercises/1901100293/1001S02E03_calculator.py b/exercises/1901100293/1001S02E03_calculator.py deleted file mode 100644 index f9957e86c..000000000 --- a/exercises/1901100293/1001S02E03_calculator.py +++ /dev/null @@ -1,31 +0,0 @@ -e='y' #初始赋值,为下方while循环提供第一次计算 -print('欢迎使用四则运算计算器,请在下方输入相应内容') -a=input('输入一个数值:') -while a.isdigit()==False: #判断是否输入数字,需要注意的是int和float没有isdigit属性 - a=input('似乎缺少一个数字,请再次输入第一个数值:') #所以这个判断必须在类型转换前 -while e=='y': #执行是否继续计算的判断,如果是,则用最后的结果继续算下去 - b=input('输入计算符号(+,-,*,/):') - c=input('输入另一个数值:') - while c.isdigit()==False: - c=input('似乎缺少一个数字,请再次输入第二个数值:') - z=b - a= float(a) #转换类型 - c= float(c) - print('计算结果为:') - if z=='+': - d=(a+c) - print(d) - elif z=='-': - d=(a-c) - print(d) - elif z=='*': - d=(a-c) - print(d) - elif z=='/': - d=(a/c) - print(d) - else: - print('符号输入错误,请重试') - a=d - e=input('是否继续计算,输入y继续,输入其他内容则结束使用:') -print('谢谢使用再见') \ No newline at end of file diff --git a/exercises/1901100293/README.md b/exercises/1901100293/README.md deleted file mode 100644 index 9220751b3..000000000 --- a/exercises/1901100293/README.md +++ /dev/null @@ -1 +0,0 @@ -This is Seven Lin diff --git a/exercises/1901100294/1001S02E01_helloworld.txt b/exercises/1901100294/1001S02E01_helloworld.txt deleted file mode 100644 index b3f52c069..000000000 --- a/exercises/1901100294/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -I need to write some english words or it can't print \ No newline at end of file diff --git a/exercises/1901100294/1001S02E02_hello_python.py b/exercises/1901100294/1001S02E02_hello_python.py deleted file mode 100644 index 00950d9ac..000000000 --- a/exercises/1901100294/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print('hello world') \ No newline at end of file diff --git a/exercises/1901100294/1001S02E03_calculator.py b/exercises/1901100294/1001S02E03_calculator.py deleted file mode 100644 index 5afe95306..000000000 --- a/exercises/1901100294/1001S02E03_calculator.py +++ /dev/null @@ -1,21 +0,0 @@ -want = input('你想进行什么计算?(加、减、乘或除)') -if want == '加': - a = int(input('请输入一个加数:')) - b = int(input('请输入另一个加数:')) - c = a + b - print('{} + {} = {}'.format(a,b,c)) -elif want == '减': - a = int(input('请输入一个减数:')) - b = int(input('请输入另一个减数:')) - c = a - b - print('{} - {} = {}'.format(a,b,c)) -elif want == '乘': - a = int(input('请输入一个乘数:')) - b = int(input('请输入另一个乘数:')) - c = a * b - print('{} + {} = {}'.format(a,b,c)) -elif want == '除': - a = int(input('请输入一个除数:')) - b = int(input('请输入另一个除数')) - c = a / b - print('{} / {} = {}'.format(a,b,c)) \ No newline at end of file diff --git a/exercises/1901100294/1001S02E04_control_flow.py b/exercises/1901100294/1001S02E04_control_flow.py deleted file mode 100644 index 4816c8446..000000000 --- a/exercises/1901100294/1001S02E04_control_flow.py +++ /dev/null @@ -1,14 +0,0 @@ -for i in range(1,10): - for j in range(1,i+1): - print( '%d X %d = %d' % (i,j,i*j),end = ' ' ) - print('\t') - - -i = 1 -while i <= 9 : - j = 1 - while j <= i: - print('%d X %d = %d' % (i,j,i*j),end = ' ') - j += 1 - print('\t') - i += 2 \ No newline at end of file diff --git a/exercises/1901100294/1001S02E05_array.py b/exercises/1901100294/1001S02E05_array.py deleted file mode 100644 index d7da085be..000000000 --- a/exercises/1901100294/1001S02E05_array.py +++ /dev/null @@ -1,24 +0,0 @@ -a = [0,1,2,3,4,5,6,7,8,9] -a.reverse() -#print(a) -b = [str(i) for i in a] #这里是使用列表推导式把列表中的单个元素全部转化为str类型 -c = ''.join(b) #或者使用' ' 使元素间用空格分隔开 -#print(c) #输出类型为字符串 - -d = c[2:8][::-1] #这是混合操作 直接切完片反转 -'''c_slice = c[2:8] 这是分开操作 先切片 再反转 -print(c_slice) -c_reverse = c_slice[::-1] -print(c_reverse)''' -e = int(d) #字符串转为整数 - -#将整数转换为二进制、八进制或十六进制的文本串,可以分别使用bin() ,oct() 或hex() 函数: - -f = bin(e) -print('这是十进制转二进制的结果:\n%s' % f) - -g = oct(e) -print('这是十进制转八进制的结果:\n%s' % g) - -h = hex(e) -print('这是十进制转十六进制进制的结果:\n%s' % g) \ No newline at end of file diff --git a/exercises/1901100294/1001S02E05_stats_text.py b/exercises/1901100294/1001S02E05_stats_text.py deleted file mode 100644 index 7b59bea1f..000000000 --- a/exercises/1901100294/1001S02E05_stats_text.py +++ /dev/null @@ -1,57 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -import collections - -list_text = text.split() #讲字符串分割成列表 -words_new = [] -for a in range(len(list_text)): - str_words = list_text[a] #遍历每一个元素 - b = str_words.strip("*-,.!") #删掉各种出现的特殊字符 - words_new.append(b) - -while '' in words_new: #删掉去掉--之后的空元素 - words_new.remove('') - -cishu_text = collections.Counter(words_new) #直接输出统计出现的次数并且按照次数从大到小排列 -print(cishu_text) - - - -'''words = text.split() -word_dict = {} -for w in words: - if w not in word_dict: - word_dict[w] = 1 - else: - word_dict[w] = word_dict[w] + 1 -print (word_dict) - -words_new = [] -for a in range(len(words)): - str_words = words[a] - b = str_words.strip("*-,.!") - print(b) - words_new.append(b) -print(words_new)''' diff --git a/exercises/1901100294/1001S02E05_string.py b/exercises/1901100294/1001S02E05_string.py deleted file mode 100644 index 7ab0b3967..000000000 --- a/exercises/1901100294/1001S02E05_string.py +++ /dev/null @@ -1,57 +0,0 @@ - -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -print('这是第1个小要求,把better换成worse\n') -text_replace = text.replace('better','worse') -print(text_replace) - -text_new = text_replace.split(' ') #把字符串分割成列表 - - -'''import re 正则表达式方法 把单词为单位分隔开 -text_string = re.findall(r"\w+",text_replace) -print(text_string)''' - -list_text = [] -for strea in text_new: - if 'ea' in strea: - strea = strea.replace(strea,'') - else: - pass - list_text.append(strea) -#删掉列表中包含ea的值 print(list_text) - -print('这是第2个小要求,删除掉包含ea的字符\n') -string_text = " ".join(list_text) #再把列表转成字符串 -print(string_text) - -print('这是第3个小要求,转换大小写\n') -text_trans = string_text.swapcase()#这是大小写转换 -print(text_trans) - -print('这是第4个小要求,将所有单词按照a...z的升序排列\n') -list_new = text_trans.split(' ') -list_new.sort() -list_sorted = "".join(list_new) -print(list_sorted) \ No newline at end of file diff --git a/exercises/1901100295/1001S02E01_helloworld.txt b/exercises/1901100295/1001S02E01_helloworld.txt deleted file mode 100644 index a3da05974..000000000 --- a/exercises/1901100295/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -һҵ diff --git a/exercises/1901100295/1001S02E02_hello_python.py b/exercises/1901100295/1001S02E02_hello_python.py deleted file mode 100644 index e75154b7c..000000000 --- a/exercises/1901100295/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print("hello world") \ No newline at end of file diff --git a/exercises/1901100295/README.md b/exercises/1901100295/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/exercises/1901100296/README.md b/exercises/1901100296/README.md index f5d2cc6f5..2a0900747 100644 --- a/exercises/1901100296/README.md +++ b/exercises/1901100296/README.md @@ -1,15 +1,2 @@ 姓名:贾苗苗 学号:1901100296 - -1、关于自学 -俗话说:万事开头难!个人感觉对于一个对开发领域完全不懂的小白来说,自学开发还是有点难度。 -个人感觉自学最大的敌人是自己的恐惧心理。每个人面对自己不熟悉、不了解、不知道的环境、事物总会措手无措,甚至给自己设置心理障碍。 -为了克服这个恐惧,你得告诉自己,这个事情只是一个我没有接触的事物,我只要一层层的将其了解清楚就可以了,不用慌张,不用逃避,迎上去看看它到底是个什么东西 -当你知道了这个东西原来是干这个用的啊,那么你对它了解了,你已经不抵触这个东西了 -当我知道这个东西是干嘛用的了,就反复用呗,哪里需要了就用它,慢慢的你就深入了解了它,哦,原来它是这样的啊 -当你看到这个事物的时候,没有了感觉,就像你拿起手机就用一样,那么你学会了! - -2.关于Python -个人感觉Python如此简单的,是为了让我们当工具用的,就像Excel一样,只不过,你得清楚了它的规则是什么,它的模块可以为你提供哪些功能。 -接下来需要大量的项目实例来巩固Python的使用熟练程度。 - diff --git a/exercises/1901100296/d08/main.py b/exercises/1901100296/d08/main.py index 294a4e031..65854629b 100644 --- a/exercises/1901100296/d08/main.py +++ b/exercises/1901100296/d08/main.py @@ -1,9 +1,4 @@ from mymodule import stats_word - -import traceback -import logging - - text = ''' 愚公移山 太行,王屋二山的北面,住了一個九十歲的⽼翁,名叫愚公。⼆山佔地廣闊,擋住去路路,使他和家人往來極為不不便。 @@ -70,25 +65,10 @@ ''' text2=45657568 - -def test_traceback(): - try: - print('统计结果:',stats_word.stats_text(text2)) +try: + print('统计结果:',stats_word.stats_text(text2)) # print('统计结果:',stats_word.stats_text_en(text2)) - # # print('统计结果:',stats_word.stats_text_cn(text2)) - except ValueError as err: - print('发现错误:',err) - print(traceback.format_exc()) - -def test_logging(): - logger = logging.getLogger(__name__) - try: - print('统计结果:',stats_word.stats_text(text2)) - except ValueError as err: - print('发现错误:',err) - logger.exception(err) - - # test_traceback() - test_logging() - + # print('统计结果:',stats_word.stats_text_cn(text2)) +except ValueError as err: + print('发现错误:',err) diff --git a/exercises/1901100296/d08/mymodule/stats_word.py b/exercises/1901100296/d08/mymodule/stats_word.py index fbb512fc4..0d2ed5996 100644 --- a/exercises/1901100296/d08/mymodule/stats_word.py +++ b/exercises/1901100296/d08/mymodule/stats_word.py @@ -1,46 +1,43 @@ # 封装统计英文单词词频的函数 def stats_text_en(text) : - - # if type(text)!=str: - if not isinstance(text,str): - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - list_text=text.lower().split() - words=[] - #剔除特殊字符并删除空字符 - symbols='*--?!.,:,、。「」' - for word in list_text: - for symbol in symbols: - word=word.replace(symbol,'') - if len(word) and word.isascii(): - words.append(word) + if type(text)==str: + list_text=text.lower().split() + words=[] + #剔除特殊字符并删除空字符 + symbols='*--?!.,:,、。「」' + for word in list_text: + for symbol in symbols: + word=word.replace(symbol,'') + # if len(word)and word<'\u4e00' or word>'\u9fff': + # if word.encode('UTF-8').isalpha(): + if len(word) and word.isascii(): + words.append(word) # 使用字典类型统计文本中单词数 - word_dic={} - keys_set=set(words) - for word in keys_set: - word_dic[word]=words.count(word) - # 对字典的值降序排列 - return sorted (word_dic.items(),key=lambda item:item[1],reverse=True) - + word_dic={} + keys_set=set(words) + for word in keys_set: + word_dic[word]=words.count(word) + # 对字典的值降序排列 + return sorted (word_dic.items(),key=lambda item:item[1],reverse=True) + ex=ValueError('参数值错误!') + raise ex # 封装统计汉字词频的函数 def stats_text_cn(text): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - # 挑拣汉字出来 - words=[] - for word in text: - if '\u4e00' <= word <= '\u9fff': - words.append(word) + if type(text)==str: + # 挑拣汉字出来 + words=[] + for word in text: + if '\u4e00' <= word <= '\u9fff': + words.append(word) # 统计文本中汉字个数 - word_dic={} - keys_set=set(words) - for word in keys_set: - word_dic[word]=words.count(word) - # 对字典值降序排列 - return sorted (word_dic.items(),key=lambda item:item[1],reverse=True) - + word_dic={} + keys_set=set(words) + for word in keys_set: + word_dic[word]=words.count(word) + # 对字典值降序排列 + return sorted (word_dic.items(),key=lambda item:item[1],reverse=True) + ex=ValueError('参数值错误!') + raise ex # 统计英文和汉字的函数 def stats_text(text): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - return(stats_text_cn(text)+stats_text_en(text)) - + return(stats_text_cn(text)+stats_text_en(text)) diff --git a/exercises/1901100296/d09/main.py b/exercises/1901100296/d09/main.py deleted file mode 100644 index 24cce0c29..000000000 --- a/exercises/1901100296/d09/main.py +++ /dev/null @@ -1,37 +0,0 @@ -from mymodule import stats_word - -from os import path -import json -import logging -logging.basicConfig( - format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG -) -# 读取文件内容 -def load_file(): - # 获取文件路径 - # print(path.abspath(__file__)) - # print(path.dirname(path.abspath(__file__))) - file_path = path.join(path.dirname(path.abspath(__file__)),'tang300.json') - # file_path = path.join(path.dirname(path.abspath(__file__)),'./tang300.json') - with open(file_path,'r',encoding='utf-8') as f: - return f.read() - f.close() -# 从json文件中获取contents值 -def merge_poems(data): - poems='' - for item in data: - poems += item.get('contents','') - return poems -def main(): - try: - data = load_file() - logging.info(data[0]) - poems = merge_poems(json.loads(data)) - logging.info('统计结果::%s',stats_word.stats_text_cn(poems,100)) - except Exception as e: - logging.exception(e) - -if __name__ == '__main__': - main() - - diff --git a/exercises/1901100296/d09/mymodule/stats_word.py b/exercises/1901100296/d09/mymodule/stats_word.py deleted file mode 100644 index 73b6cdd37..000000000 --- a/exercises/1901100296/d09/mymodule/stats_word.py +++ /dev/null @@ -1,36 +0,0 @@ -import collections - -def stats_text_en(text,count) : - # if type(text)!=str: - if not isinstance(text,str): - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - list_text=text.lower().split() - words=[] - #剔除特殊字符并删除空字符 - symbols='*--?!.,:,、。「」' - for word in list_text: - for symbol in symbols: - word=word.replace(symbol,'') - if len(word) and word.isascii(): - words.append(word) - # 使用标准库的Counter统计词频,并排序输出 - return collections.Counter(words).most_common(count) -# 封装统计汉字词频的函数 -def stats_text_cn(text,count): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - # 挑拣汉字出来 - words=[] - for word in text: - if '\u4e00' <= word <= '\u9fff': - words.append(word) - # 使用标准库的Counter统计词频,并排序输出 - return collections.Counter(words).most_common(count) - -# 统计英文和汉字的函数 -def stats_text(text,count): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - return(stats_text_cn(text,count)+stats_text_en(text,count)) - - diff --git a/exercises/1901100296/d10/main.py b/exercises/1901100296/d10/main.py deleted file mode 100644 index 5a2b94106..000000000 --- a/exercises/1901100296/d10/main.py +++ /dev/null @@ -1,36 +0,0 @@ -from mymodule import stats_word -from os import path -import json -import logging -logging.basicConfig( - format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG -) -# 读取文件内容 -def load_file(): - # 获取文件路径 - # print(path.abspath(__file__)) - # print(path.dirname(path.abspath(__file__))) - file_path = path.join(path.dirname(path.abspath(__file__)),'tang300.json') - # file_path = path.join(path.dirname(path.abspath(__file__)),'./tang300.json') - with open(file_path,'r',encoding='utf-8') as f: - return f.read() - f.close() -# 从json文件中获取contents值 -def merge_poems(data): - poems='' - for item in data: - poems += item.get('contents','') - return poems -def main(): - try: - data = load_file() - logging.info(data[0]) - poems = merge_poems(json.loads(data)) - logging.info('统计结果::%s',stats_word.stats_text_cn(poems,20)) - # print(stats_word.stats_text_cn(poems,20)) - except Exception as e: - logging.exception(e) - -if __name__ == '__main__': - main() - diff --git a/exercises/1901100296/d10/mymodule/stats_word.py b/exercises/1901100296/d10/mymodule/stats_word.py deleted file mode 100644 index 279adbf98..000000000 --- a/exercises/1901100296/d10/mymodule/stats_word.py +++ /dev/null @@ -1,16 +0,0 @@ -import collections -import jieba - -# 封装统计汉字词频的函数 -def stats_text_cn(text,count): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - # 使用jieba分词 - seg_words = jieba.cut(text) - # 长度大于等于2的词 - words = [] - for word in seg_words: - if len(word) >= 2: - words.append(word) - # 使用标准库的Counter统计词和词频数,返回前count位的数据 - return collections.Counter(words).most_common(count) diff --git a/exercises/1901100296/d11/main.py b/exercises/1901100296/d11/main.py deleted file mode 100644 index 386d364be..000000000 --- a/exercises/1901100296/d11/main.py +++ /dev/null @@ -1,41 +0,0 @@ -from mymodule import stats_word -import getpass -import yagmail -import requests -import logging -from pyquery import PyQuery - -# 获取网页内容 -def get_content(url): - # 请求网页返回内容 - response = requests.get(url) - # 提取微信公众号正⽂ - document = PyQuery(response.text) - content = document('#js_content').text() - return content -# 发邮件 -def post_email(content,title): - sender = input('输⼊发件⼈邮箱:') - password = getpass.getpass('输⼊发件⼈邮箱密码(可复制粘贴):') - recipients = input('输⼊收件⼈邮箱:') - # yag = yagmail.SMTP(sender,password) - # yag = yagmail.SMTP(sender,password,'smtp.163.com') - yag = yagmail.SMTP(sender,password,'smtp.qq.com') - yag.send(recipients,title,content) - -def main(): - logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message)s',level=logging.DEBUG) - try: - url='https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA' - content = stats_word.stats_text_cn(get_content(url),100) - # content = '测试!!' - # print('统计结果:',content) - # logging.info('%s %s',type(content),str(content)) - post_email(content,'1901100296 自学训练营学习20群DAY11') - logging.info('已发送,请注意查收!') - except Exception as e: - logging.exception(e) - -if __name__ == '__main__': - main() - diff --git a/exercises/1901100296/d11/mymodule/stats_word.py b/exercises/1901100296/d11/mymodule/stats_word.py deleted file mode 100644 index 849b4b092..000000000 --- a/exercises/1901100296/d11/mymodule/stats_word.py +++ /dev/null @@ -1,29 +0,0 @@ -import collections -import jieba - -import json - -# 封装统计汉字词频的函数 -def stats_text_cn(text,count): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - # 使用jieba分词 - seg_words = jieba.cut(text) - # 长度大于等于2的词 - words = [] - for word in seg_words: - if len(word) >= 2: - words.append(word) - # 使用标准库的Counter统计词和词频数,返回前count位的数据 - cnt_words = collections.Counter(words).most_common(count) - - # res_words = str(cnt_words) - - res_words='' - for r in cnt_words: - a,b = r - w = a + ':' +str(b) - # print(w) - res_words = res_words + '\n' + w - - return res_words diff --git a/exercises/1901100296/d12/main.py b/exercises/1901100296/d12/main.py deleted file mode 100644 index d0b27bbc2..000000000 --- a/exercises/1901100296/d12/main.py +++ /dev/null @@ -1,28 +0,0 @@ -from mymodule import stats_word -import getpass -import yagmail -from wxpy import * - - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message:%(message)s',level=logging.DEBUG) -def main(): - # 初始化机器人,扫码登录 - bot = Bot() - # 找到好友和群聊 - my_friends = bot.friends() - # family_group = bot.groups() - - # 监听好友信息,自动响应分享类型的消息 - @bot.register(my_friends,SHARING) - def handler(msg): - try: - logging.info('sharing url=%s',msg.url) - result = stats_word.stats_text_cn(stats_word.getcontent(msg.url),100) - msg.reply(str(result)) - except Exception as e: - logging.exception(e) - embed() -if __name__ == '__main__': - main() - - diff --git a/exercises/1901100296/d12/mymodule/stats_word.py b/exercises/1901100296/d12/mymodule/stats_word.py deleted file mode 100644 index f6ee982b2..000000000 --- a/exercises/1901100296/d12/mymodule/stats_word.py +++ /dev/null @@ -1,33 +0,0 @@ -import collections -import jieba -import requests -import yagmail -import json -from pyquery import PyQuery - -# 获取网页内容 -def getcontent(url): - # 请求网页返回内容 - response = requests.get(url) - # 提取微信公众号正⽂ - document = PyQuery(response.text) - content = document('#js_content').text() - return content - - -# 封装统计汉字词频的函数 -def stats_text_cn(text,count): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - # 使用jieba分词 - seg_words = jieba.cut(text) - # 长度大于等于2的词 - words = [] - for word in seg_words: - if len(word) >= 2: - words.append(word) - # 使用标准库的Counter统计词和词频数,返回前count位的数据 - cnt_words = collections.Counter(words).most_common(count) - - return cnt_words - diff --git a/exercises/1901100296/d13/SimHei.ttf b/exercises/1901100296/d13/SimHei.ttf deleted file mode 100644 index 36f58fbd8..000000000 Binary files a/exercises/1901100296/d13/SimHei.ttf and /dev/null differ diff --git a/exercises/1901100296/d13/main.py b/exercises/1901100296/d13/main.py deleted file mode 100644 index c620a3201..000000000 --- a/exercises/1901100296/d13/main.py +++ /dev/null @@ -1,52 +0,0 @@ -from mymodule import stats_word -import getpass -import yagmail -from wxpy import * -import matplotlib.pyplot as plt -import matplotlib -import numpy as np -from os import path - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)d|message:%(message:%(message)s',level=logging.DEBUG) - -file_path = path.join(path.dirname(path.abspath(__file__)),'SimHei.ttf') - -# 将统计结果画成条形图并返回条形图的保存路径 -def stats_barplot(list_data): - zhfont1 = matplotlib.font_manager.FontProperties(fname=file_path) - - words = [x[0] for x in list_data ] - frequence = [x[1] for x in list_data] - - fig,ax = plt.subplots() - ax.barh(words,frequence) - ylabels = ax.get_yticklabels() - plt.setp(ylabels,FontProperties=zhfont1) - ax.set_xlabel('词频',FontProperties=zhfont1) - ax.set_ylabel('词语',FontProperties=zhfont1) - ax.set_title('文章中出现次数在前10的词语',FontProperties=zhfont1) - png_path = path.join(path.dirname(path.abspath(__file__)),'stats_words_barplot.png') - fig.savefig(png_path,transparen=False,dpi=80,bbox_inches="tight") - # plt.show() - return png_path - -def main(): - # 初始化机器人,扫码登录 - bot = Bot() - # 找到好友和群聊 - my_friends = bot.friends() - # family_group = bot.groups() - - # 监听好友信息,自动响应分享类型的消息 - @bot.register(my_friends,SHARING) - def handler(msg): - try: - logging.info('sharing url=%s',msg.url) - msg.reply(stats_barplot(result)) - except Exception as e: - logging.exception(e) - embed() - -if __name__ == '__main__': - main() - diff --git a/exercises/1901100296/d13/mymodule/stats_word.py b/exercises/1901100296/d13/mymodule/stats_word.py deleted file mode 100644 index 54e8ace51..000000000 --- a/exercises/1901100296/d13/mymodule/stats_word.py +++ /dev/null @@ -1,31 +0,0 @@ -import collections -import jieba -import requests -import yagmail -import json -from pyquery import PyQuery - -# 获取网页内容 -def getcontent(url): - # 请求网页返回内容 - response = requests.get(url) - # 提取微信公众号正⽂ - document = PyQuery(response.text) - content = document('#js_content').text() - return content - - -# 封装统计汉字词频的函数 -def stats_text_cn(text,count): - if type(text)!=str: - raise ValueError('输入类型 %s,参数必须是 str 类型'%type(text)) - # 使用jieba分词 - seg_words = jieba.cut(text) - # 长度大于等于2的词 - words = [] - for word in seg_words: - if len(word) >= 2: - words.append(word) - # 使用标准库的Counter统计词和词频数,返回前count位的数据 - cnt_words = collections.Counter(words).most_common(count) - return cnt_words diff --git a/exercises/1901100297/1001S02E05_array.py b/exercises/1901100297/1001S02E05_array.py deleted file mode 100644 index 9a0281e6b..000000000 --- a/exercises/1901100297/1001S02E05_array.py +++ /dev/null @@ -1,20 +0,0 @@ -#将数组 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 翻转 -sample_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -reversed_list = sample_list[::-1] -print(reversed_list) -#翻转后的数组拼接成字符串 -str_list = ''.join(str(i) for i in reversed_list) -print(str_list) -#⽤用字符串串切⽚片的⽅方式取出第三到第⼋八个字符 -slice_str = str_list[2:8] -print(slice_str) -#将获得的字符串串进⾏行行翻转 -reversed_str = slice_str[::-1] -print(reversed_str) -#将结果转换为 int 类型 -int_str = int(reversed_str) -print(int_str) -#分别转换成⼆二进制,⼋八进制,⼗十六进制,最后输出三种进制的结果 -print('二进制:',bin(int_str)) -print('八进制:',oct(int_str)) -print('十六进制:',hex(int_str)) \ No newline at end of file diff --git a/exercises/1901100297/1001S02E05_stats_text.py b/exercises/1901100297/1001S02E05_stats_text.py deleted file mode 100644 index be28346d3..000000000 --- a/exercises/1901100297/1001S02E05_stats_text.py +++ /dev/null @@ -1,43 +0,0 @@ -text_sample = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -#使⽤用字典(dict)统计字符串样本 text 中各个英⽂文单词出现的次数。 - -elements = text_sample.split() -words = [] -symbols = ',.*-!' -for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element): - words.append(element) -print(words) - -counter = {} -word_set = set(words) -for word in word_set: - counter[word] = words.count(word) -print(counter) -print(sorted(counter.items(),key=lambda x:x[1],reverse=True)) \ No newline at end of file diff --git a/exercises/1901100297/1001S02E05_string.py b/exercises/1901100297/1001S02E05_string.py deleted file mode 100644 index 319af9c67..000000000 --- a/exercises/1901100297/1001S02E05_string.py +++ /dev/null @@ -1,45 +0,0 @@ -text_sample = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -#将字符串串样本 text ⾥里里的 better 全部替换成 worse -text = text_sample.replace('better','worse') -print(text) - -#从第 2 步的结果⾥里里,将单词中包含 ea 的单词剔除 -words = text.split() -notea = [] -for word in words: - if word.find('ea') < 0: - notea.append(word) -print(notea) - -#将第 3 步的结果⾥里里的字⺟母进⾏行行⼤大⼩小写翻转 -daxiao = [i.swapcase() for i in notea] -print(daxiao) - -#将第 4 步的结果⾥里里所有单词按 a…z 升序排列列,并输出结果 -shenxu = sorted(daxiao) -print(shenxu) \ No newline at end of file diff --git a/exercises/1901100303/1-9.py b/exercises/1901100303/1-9.py index 099dc4f4b..829e7bd1e 100644 --- a/exercises/1901100303/1-9.py +++ b/exercises/1901100303/1-9.py @@ -1,11 +1,3 @@ - -from IPython.core.interactiveshell import InteractiveShell -InteractiveShell.ast_node_interactivity = 'all' -import sys -#print(sys.builtin_module_names) -print("_sre" in sys.builtin_module_names) -print("math" in sys.builtin_module_names) - for row in range(1,10): for col in range(1,10): prod=row*col @@ -14,4 +6,4 @@ print(row*col,' ',end='') print() - + \ No newline at end of file diff --git a/exercises/1901100303/1001S02E04_control_flow.py b/exercises/1901100303/1001S02E04_control_flow.py index 818a79251..06cfe7e39 100644 --- a/exercises/1901100303/1001S02E04_control_flow.py +++ b/exercises/1901100303/1001S02E04_control_flow.py @@ -1,20 +1,4 @@ -def takeSecond(elem): - return elem[0] - -# 列表 -random = [(2, 2), (3, 4), (4, 1), (1, 3)] - -# 指定第二个元素排序 -random.sort(key=takeSecond) - -# 输出类别 -print ('排序列表:', random) - - - - - for col in range(1,10): for row in range(1,col+1): print(str(col),"*",str(row),'=',row*col,' ',end='') @@ -32,5 +16,4 @@ def takeSecond(elem): c=c+1 print() r=r+1 - - + \ No newline at end of file diff --git a/exercises/1901100303/d07/main.py b/exercises/1901100303/d07/main.py deleted file mode 100644 index cdd4bbcf2..000000000 --- a/exercises/1901100303/d07/main.py +++ /dev/null @@ -1,2 +0,0 @@ -from mymodule import stats_word -stats_word.stats_text() diff --git a/exercises/1901100303/d07/mymodule/main.py b/exercises/1901100303/d07/mymodule/main.py deleted file mode 100644 index d5b78c9a0..000000000 --- a/exercises/1901100303/d07/mymodule/main.py +++ /dev/null @@ -1,2 +0,0 @@ -import stats_word -stats_word.stats_text() diff --git a/exercises/1901100303/d07/mymodule/stats_word.py b/exercises/1901100303/d07/mymodule/stats_word.py deleted file mode 100644 index b12c28f90..000000000 --- a/exercises/1901100303/d07/mymodule/stats_word.py +++ /dev/null @@ -1,45 +0,0 @@ -def stats_text_en(text): #定义函数 - #统计参数中每个英⽂文单词出现的次数,最后返回⼀一个按词频降序排列列的数组 - text_list = text.split() #字符串切片,赋值给list - counter = {} #定义字典 - return_list = {} #定义返回值 - text_set =set(text_list) #list去重 - for i in text_set: # - counter[i] = text_list.count(i) - - return_list = sorted(counter.items(),key=lambda x:x[1],reverse = True) - return return_list - - -def stats_text_cn(text_cn): - #统计参数中每个中文汉字出现的次数,最后返回⼀一个按字频降序排列列的数组 - cn_char= [] - for char in text_cn: - cn_char.append(char) - - counter_cn = {} - return_list_cn = {} - text_set_cn = set(cn_char) - - for j in text_set_cn: - counter_cn[j] = cn_char.count(j) - - return_list_cn = sorted(counter_cn.items(),key=lambda x:x[1],reverse= True) - - return return_list_cn - -#print(stats_text_cn("""中国共产党万岁,中国人民万岁""")) - -def stats_text(): - #调用stats_text_en 和 stats_text_cn 两个函数,将两个函数的输出结果合并为一个list,输出。 - main_list = [] - main_list = stats_text_en("""The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense.""") + stats_text_cn("""中国共产党万岁,中国人民万岁""") - - return main_list -print(stats_text()) \ No newline at end of file diff --git a/exercises/1901100303/d08/main.py b/exercises/1901100303/d08/main.py deleted file mode 100644 index 8d2aa1263..000000000 --- a/exercises/1901100303/d08/main.py +++ /dev/null @@ -1,13 +0,0 @@ -from mymodule import stats_word - - -sample_text =11111 - -try: - result = stats_word.stats_text(sample_text) -except TypeError: - print("输入的参数类型不对,请输入字符串。") -except AttributeError: - print("切片语法错误") - - diff --git a/exercises/1901100303/d08/mymodule/main.py b/exercises/1901100303/d08/mymodule/main.py deleted file mode 100644 index d5b78c9a0..000000000 --- a/exercises/1901100303/d08/mymodule/main.py +++ /dev/null @@ -1,2 +0,0 @@ -import stats_word -stats_word.stats_text() diff --git a/exercises/1901100303/d08/mymodule/stats_word.py b/exercises/1901100303/d08/mymodule/stats_word.py deleted file mode 100644 index 1fe7f34f0..000000000 --- a/exercises/1901100303/d08/mymodule/stats_word.py +++ /dev/null @@ -1,52 +0,0 @@ -def stats_text_en(text): #定义函数 - #统计参数中每个英⽂文单词出现的次数,最后返回⼀一个按词频降序排列列的数组 - text_list = text.split() #字符串切片,赋值给list - counter = {} #定义字典 - return_list = {} #定义返回值 - text_set =set(text_list) #list去重 - for i in text_set: # - counter[i] = text_list.count(i) - - return_list = sorted(counter.items(),key=lambda x:x[1],reverse = True) - return return_list - - -def stats_text_cn(text_cn): - #统计参数中每个中文汉字出现的次数,最后返回⼀一个按字频降序排列列的数组 - cn_char= [] - for char in text_cn: - cn_char.append(char) - - counter_cn = {} - return_list_cn = {} - text_set_cn = set(cn_char) - - for j in text_set_cn: - counter_cn[j] = cn_char.count(j) - - return_list_cn = sorted(counter_cn.items(),key=lambda x:x[1],reverse= True) - - return return_list_cn - -#print(stats_text_cn("""中国共产党万岁,中国人民万岁""")) - -def stats_text(text): - #调用stats_text_en 和 stats_text_cn 两个函数,将两个函数的输出结果合并为一个list,输出。 - - return stats_text_en(text) + stats_text_cn(text) - -try: - print(stats_text_cn(12345)) -except ValueError: - print("错误的输入参数:") -except TypeError: - print("输入的参数类型不对") - -try: - print(stats_text_en(12345)) -except ValueError: - print("错误的输入参数:") -except TypeError: - print("输入的参数类型不对") -except AttributeError: - print("切片语法错误") \ No newline at end of file diff --git a/exercises/1901100303/mycode.py b/exercises/1901100303/mycode.py deleted file mode 100644 index 32e754298..000000000 --- a/exercises/1901100303/mycode.py +++ /dev/null @@ -1,15 +0,0 @@ -def is_prime(n): - """ - Return a boolean value base upon - whether the argument n is a prime number. - """ - if n<2: - return False - if n==2: - return True - for m in range(2,int(n**0.5)+1): - if (n%m) == 0: - return False - else: - return True - diff --git a/exercises/1901100307/1001S02E01_helloworld.txt b/exercises/1901100307/1001S02E01_helloworld.txt deleted file mode 100644 index a08a79809..000000000 --- a/exercises/1901100307/1001S02E01_helloworld.txt +++ /dev/null @@ -1,8 +0,0 @@ -{\rtf1\ansi\ansicpg936\cocoartf1404\cocoasubrtf470 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\fs24 \cf0 hello\ -} \ No newline at end of file diff --git a/exercises/1901100307/README.md.rtf b/exercises/1901100307/README.md.rtf deleted file mode 100644 index be531cc07..000000000 --- a/exercises/1901100307/README.md.rtf +++ /dev/null @@ -1,8 +0,0 @@ -{\rtf1\ansi\ansicpg936\cocoartf1404\cocoasubrtf470 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 - -\f0\fs24 \cf0 readme\ -} \ No newline at end of file diff --git a/exercises/1901100350/1001S02E03_calculator.py b/exercises/1901100350/1001S02E03_calculator.py index 5f5c64521..e1f27da57 100644 --- a/exercises/1901100350/1001S02E03_calculator.py +++ b/exercises/1901100350/1001S02E03_calculator.py @@ -17,6 +17,4 @@ elif operator == '/': print (a, '/', b, '=', a / b) else: - - print('无效的运算符') - + print('无效的运算符') \ No newline at end of file diff --git a/exercises/1901100350/1001S02E05_array.py b/exercises/1901100350/1001S02E05_array.py deleted file mode 100644 index d779187cd..000000000 --- a/exercises/1901100350/1001S02E05_array.py +++ /dev/null @@ -1,29 +0,0 @@ -1#对列表翻转 -a_list = [0,1,2,3,4,5,6,7,8,9] -reversed_list = (a_list[::-1]) -print("list",reversed_list ) - -2#翻转列表拼接成字符串 -join_str = ''.join([str(i) for i in reversed_list]) -print('list',join_str) - -3#用字符串切片的方式取出第三到第八个字符(包括八) -sliced_str = join_str[2:8] -print('list',sliced_str) - -4#将获得的字符串翻转 -reversed_str =sliced_str[::-1] -print('list',reversed_str) - -5#将结果转换为int -int_value = int(reversed_str) -print('int',int_value) - -6#转换为2进制 -print('int',bin(int_value)) - -7#转换为8进制 -print('int',oct(int_value)) - -8#转换为16进制 -print('int',hex(int_value)) \ No newline at end of file diff --git a/exercises/1901100350/1001S02E05_stats_text.py b/exercises/1901100350/1001S02E05_stats_text.py deleted file mode 100644 index 9dadaddae..000000000 --- a/exercises/1901100350/1001S02E05_stats_text.py +++ /dev/null @@ -1,63 +0,0 @@ -sample_text = ''' The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. Sparse is better than dense. Readability counts. -Special cases aren't special enough to break the rules. Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - - - -# 使用字典(dic类型)统计字符串样本test中各个英文单词出现的次数。 -#先将字符串根据空白字符 分割成list,要调用str类型 -elements = sample_text.split() - -#定义一个新的list 变量,存储处理过的单词 -words = [] - -#先针对样本文本挑选出需要剔除的非单词符号 - -symbols = ',.*-!' - -for element in elements: -#循环一遍要剔除的符号 - for symbol in symbols: - #逐个替换字符号,用'' 是为了同时剔除符号所占的位置 - element = element . replace(symbols,'') - #剔除字符后,如果element长度不为零,则算正常单词 - if len(element): - words.append(element) - -print('正常的英文单词 ==>',words) - -#初始化一个(dic字典)类型的变量,用来存放单词出现的次数 -counter = {} - -#set(集合)类型可以去掉列表里的重复元素,可以在for..in..里减少循环次数。 -word_set = set (words) - -for word in word_set: - counter [word] = words.count(word) -print('正常的英文单词出现的次数 ==>',counter) - -2#按照出现次数从大到小输出所有的单词及出现的次数 -#内置函数sorted的参数key表示按元素的那一项的值进行排列 -#dic类型的counter的items方法,会返回一个包含相应项(key,value)的元祖列表 -#print('counter.items()==>',counter.items()) -print('从大到小输出所有的单词及出现的次数==>',sorted(counter.items()\ - ,key = lambda x:x[1],reverse=True)) - - - - - diff --git a/exercises/1901100350/1001S02E05_string.py b/exercises/1901100350/1001S02E05_string.py deleted file mode 100644 index 6d6ecca1f..000000000 --- a/exercises/1901100350/1001S02E05_string.py +++ /dev/null @@ -1,47 +0,0 @@ -sample_text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. - -Readability counts. - -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -1#将字符串样本text里的所有 better 替换为 worse. - -text = sample_text.replace("better","worse") -print("str",text) - -2#将单词中含有ea剔除 -#先将字符串根据空白字符分割成list,要调用str -words = text.split() -#定义一个list类型的变量存放过滤完的单词 -filtered = [] -#用for...in循环来检查是否含有ea -for word in words: - if word .find ('ea') < 0: - filtered.append(word) -print("str",filtered) - -3# -swapcased = [i.swapcased() for i in filtered] -print("进行大小写翻转 ==>",swapcased) - - - diff --git a/exercises/1901100350/1001S02E06_stats_word.py b/exercises/1901100350/1001S02E06_stats_word.py deleted file mode 100644 index 14c8432de..000000000 --- a/exercises/1901100350/1001S02E06_stats_word.py +++ /dev/null @@ -1,92 +0,0 @@ -en_text = ''' The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. Sparse is better than dense. Readability counts. -Special cases aren't special enough to break the rules. Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those!''' - -cn_text = ''' - -第2季(共10集) -据悉,新一季背景将部分设定在二战期间日裔美国人拘留营 -“从南加州的家乡到拘留营再到太平洋战场的前线,一种神秘怪物恐吓着一个日裔美国人社区。” -该系列的主创之一Alexander Woo将担任新一季的剧集运作人。他本人也在第一时间发表了如下声明: -“我倍感荣幸能有机会讲述这样一个非常时期的特殊故事 -我们希望能将这种历史经历带来的不幸恐惧以一种紧扣当下现实的方式呈现出来 -能有大部分亚裔以及亚裔美国人的参与是一件令人兴奋又让人谦虚的事。” -《极地恶灵》第1季于3月份登陆AMC -围绕19世纪40年代英国皇家海军惊恐号探索北极圈“西北航道”的故事展开。 -年回归,具体日期和演员招募有待官宣 -''' - -#定义一个名为stars_text_en的函数,函数接受一个字符串text作为参数。 - -def stars_text_en (text): - - - elements = text.split() - - - words = [] - - - - symbols = ',.*-!' - - for element in elements: - - for symbol in symbols: - - element = element . replace(symbols,'') - - if len(element): - words.append(element) - - - - - counter = {} - - - word_set = set (words) - - for word in word_set: - counter [word] = words.count(word) - return sorted(counter.items(), key = lambda x:x[1],reverse=True) - - - - #统计参数中每个汉字出现的次数 - def stars_text_cn(text): - cn_characters = [] - for charcters in text: - #unicode的中文取值范围 - if '\u4e00' <= character <= '\u9fff': - cn_charcters.append(characters) - counter = {} - cn_charaters_set = set(cn_charcters) - for characters in cn_charaters_set: - counter [characters] = cn_cheraters.count(characters) - return sorted(count.items(), key = lambda x:x[1],reverse = True) - - - - #搜索 __name__==__main__ - #一般情况下在文件内测试代码的时候以下面的形式进行 - if __name__ == "__main__": - en_result = stars_text_en(en_text) - cn_result = stars_text_cn(cn_text) - print('统计参数中每个英文单词出现的次数 ==>\n',en_result) - print('统计参数中每个中文单词出现的次数 ==>\n',cn_result) - - diff --git a/exercises/1901100350/22001E04_control_flow.py b/exercises/1901100350/22001E04_control_flow.py deleted file mode 100644 index ef0546152..000000000 --- a/exercises/1901100350/22001E04_control_flow.py +++ /dev/null @@ -1,9 +0,0 @@ -i = 1 -while i < 10: - if i%2 == 0 - continue - print (i) -for j in range(1, i + 1): - print(j, '*', i, '=', i * j, end=" \t ") - print () - \ No newline at end of file diff --git a/exercises/1901100350/mash.py b/exercises/1901100350/mash.py deleted file mode 100644 index 7cee4ae50..000000000 --- a/exercises/1901100350/mash.py +++ /dev/null @@ -1,22 +0,0 @@ -#n = ["f","b","A"] -#n.append("y") -#print('sort:',n) - - - -#n = ["f","b","A"] -#n.pop() -#print('pop:',n) - - - -#str = "9,8,7,6,5,4,3,2,1,0" -#arr = str.split(',') -#print () - -y="abc abc abc abc" -z=y.replace("a","A") -x=y.replace("a","A",2) -print(z) -print(x) -input("按回车键结束!") \ No newline at end of file diff --git a/exercises/1901100351/1001S02E05_stats_text1.py b/exercises/1901100351/1001S02E05_stats_text1.py deleted file mode 100644 index dd207881a..000000000 --- a/exercises/1901100351/1001S02E05_stats_text1.py +++ /dev/null @@ -1,31 +0,0 @@ -sample_text = ''' -the Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - - - -for word in word_set: - counter[word] = words.count(word) -print('英文单词出现次数 ==>',counter) - -print('从大到小输出所有单词出现的次数 ==>', sorted(counter.items(), key=lambda x: x[1], reverse=True)) \ No newline at end of file diff --git a/exercises/1901100351/1001S02E06_stats_word1.py b/exercises/1901100351/1001S02E06_stats_word1.py deleted file mode 100644 index 26e1c8326..000000000 --- a/exercises/1901100351/1001S02E06_stats_word1.py +++ /dev/null @@ -1,79 +0,0 @@ -# 统计参数中英文单词出现的次数,并按降序排列 -def stats_text_en(text): #定义函数 - elements = text.split()#对字符串进行切片 - words = []#设置列表 - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element): - words.append(element) - counter = {}#创建字典 - word_set = set(words)#创建无序不重复集合 - - for word in word_set: - counter[word] = words.count(word) - return sorted(counter.items(), key=lambda x:x[1], reverse=True) - -# 统计参数中汉字出现次数,并按降序排列 -def stats_text_cn(text):#设定函数 - cn_charactors = [] - for charactor in text: - if '\u4e00'<= charactor <= '\u9fff':#中文字符的代码区间 - cn_charactors.append(charactor) - counter = {}#创建字典 - cn_charactor_set = set(cn_charactors) - for charactor in cn_charactor_set: - counter[charactor] = cn_charactors.count(charactor) - return sorted(counter.items(),key=lambda x:x[1], reverse=True) - - -en_text = ''' -the Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -cn_text = ''' -Python之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -尽管实用会打破纯粹,也不可违背规则 -不要包容任何错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是 Python 之父 -做也许好过不做,但不假思索就动手还不如不做 -如果你无法向人描述你的方案,那肯定不是一个好方案;反之亦然 -命名空间是一种绝妙的理念,请多加利用 -''' - -if __name__ == "__main__": - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) - print('统计参数中英文单词出现次数==>\n', en_result) - print('统计参数中汉字出现次数==>\n', cn_result) \ No newline at end of file diff --git a/exercises/1901100351/d07/mymodule/main.py b/exercises/1901100351/d07/mymodule/main.py deleted file mode 100644 index e15f8fd6c..000000000 --- a/exercises/1901100351/d07/mymodule/main.py +++ /dev/null @@ -1,54 +0,0 @@ -import stats_word - -text = ''' -愚公移山 -太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他和家人往來極為不便。 -一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎樣?」 -大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」 -大家都熱烈地說:「把土石丟進渤海裏。」 -於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。 -愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。 -寒來暑往,他們要一年才能往返渤海一次。 -住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」 -愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。 -而這二山是不會加大的,總有一天,我們會把它們剷平。」 -智叟聽了,無話可說: -二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命 -兩位大力神揹走二山。 - - -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north -of two high mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get around. -One day yugong gathered his family -together and said,”Let’s do our best to level these two mountains. We shall open a road that leads to Yuzhou. What -do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin and Mount Wanwu? Moreover, where will all the -earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons -started to break up rocks and remove the earth. They transported the earth and rubble to the Sea of Bohai. -Now Yugong -’s neighbour was a widow who had an only child eight years old. Evening the young boy offered his help eagerly. -Summer went by and winter came. It took Yugong and his crew a full year to travel back and forth once. -On the bank of -the Yellow River dwelled an old man much respected for his wisdom. When he saw their back-breaking labour, he -ridiculed Yugong saying,”Aren’t you foolish, my friend? You are very old now, and with whatever remains of your -waning strength, you won’t be able to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A -biased person like you will never understand. You can’t even compare with the widow’s little boy!” -“Even if I -were dead, there will still be my children, my grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not grow any taler. We shall level them one day!” he -declared with confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how -determined Yugong and his crew were, they were struck with fear and reported the incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered two mighty gods to carry the mountains away. -''' - -print(stats_word.stats_text(text)) \ No newline at end of file diff --git a/exercises/1901100351/d07/mymodule/stats_word.py b/exercises/1901100351/d07/mymodule/stats_word.py deleted file mode 100644 index 351cb11c7..000000000 --- a/exercises/1901100351/d07/mymodule/stats_word.py +++ /dev/null @@ -1,83 +0,0 @@ -# 统计参数中英文单词出现的次数,并按降序排列 -def stats_text_en(text): #定义函数 - elements = text.split()#对字符串进行切片 - words = []#设置列表 - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element): - words.append(element) - counter = {}#创建字典 - word_set = set(words)#创建无序不重复集合 - - for word in word_set: - counter[word] = words.count(word) - return sorted(counter.items(), key=lambda x:x[1], reverse=True) - -# 统计参数中汉字出现次数,并按降序排列 -def stats_text_cn(text):#设定函数 - cn_charactors = [] - for charactor in text: - if '\u4e00'<= charactor <= '\u9fff':#中文字符的代码区间 - cn_charactors.append(charactor) - counter = {}#创建字典 - cn_charactor_set = set(cn_charactors) - for charactor in cn_charactor_set: - counter[charactor] = cn_charactors.count(charactor) - return sorted(counter.items(),key=lambda x:x[1], reverse=True) - -# 合并英汉词频统计 -def stats_text(text_en_cn) : - return (stats_text_en(text_en_cn)+stats_text_cn(text_en_cn)) - - -en_text = ''' -the Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -cn_text = ''' -Python之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -尽管实用会打破纯粹,也不可违背规则 -不要包容任何错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是 Python 之父 -做也许好过不做,但不假思索就动手还不如不做 -如果你无法向人描述你的方案,那肯定不是一个好方案;反之亦然 -命名空间是一种绝妙的理念,请多加利用 -''' - -if __name__ == "__main__": - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) - print('统计参数中英文单词出现次数==>\n', en_result) - print('统计参数中汉字出现次数==>\n', cn_result) \ No newline at end of file diff --git a/exercises/1901100351/d08/mymodule/main.py b/exercises/1901100351/d08/mymodule/main.py deleted file mode 100644 index 3ecc69091..000000000 --- a/exercises/1901100351/d08/mymodule/main.py +++ /dev/null @@ -1,31 +0,0 @@ -# this is d8 exercise for erros and exceptions - -# date: 2019.09.15;renew in 09.18 -# author by: rtgong - -import stats_word -import traceback -import logging - - -logger = logging.getLogger(__name__) - - -def test_traceback(): - try: - stats_word.stats_text(1) - except Exception as e: - print('test_traceback =>',e) - print(traceback.format_exc()) - -def test_logger(): - try: - stats_word.stats_text(1) - except Exception as e: - logger.exception(e) - -if __name__=="__main__": - test_traceback() - test_logger() - - diff --git a/exercises/1901100351/d08/mymodule/stats_word.py b/exercises/1901100351/d08/mymodule/stats_word.py deleted file mode 100644 index 85a0a320d..000000000 --- a/exercises/1901100351/d08/mymodule/stats_word.py +++ /dev/null @@ -1,99 +0,0 @@ -# this is d8 exercise for erros and exceptions - -# author by: rtgong - -# 统计参数中英文单词出现的次数,并按降序排列 -def stats_text_en(text): #定义函数 - - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - elements = text.split()#对字符串进行切片 - words = []#设置列表 - symbols = ',.*-!' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - if len(element): - words.append(element) - counter = {}#创建字典 - word_set = set(words)#创建无序不重复集合 - - for word in word_set: - counter[word] = words.count(word) - return sorted(counter.items(), key=lambda x:x[1], reverse=True) - - -# 统计参数中汉字出现次数,并按降序排列 -def stats_text_cn(text):#设定函数 - - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - cn_charactors = [] - for charactor in text: - if '\u4e00'<= charactor <= '\u9fff':#中文字符的代码区间 - cn_charactors.append(charactor) - counter = {}#创建字典 - cn_charactor_set = set(cn_charactors) - for charactor in cn_charactor_set: - counter[charactor] = cn_charactors.count(charactor) - return sorted(counter.items(),key=lambda x:x[1], reverse=True) - - -# 合并英汉词频统计 -def stats_text(text_en_cn) : - if not isinstance(text_en_cn,str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text_en_cn)) - return (stats_text_en(text_en_cn)+stats_text_cn(text_en_cn)) - - - - -en_text = ''' -the Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -cn_text = ''' -Python之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -尽管实用会打破纯粹,也不可违背规则 -不要包容任何错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是 Python 之父 -做也许好过不做,但不假思索就动手还不如不做 -如果你无法向人描述你的方案,那肯定不是一个好方案;反之亦然 -命名空间是一种绝妙的理念,请多加利用 -''' - -if __name__ == "__main__": - en_result = stats_text_en(en_text) - cn_result = stats_text_cn(cn_text) - print('统计参数中英文单词出现次数==>\n', en_result) - print('统计参数中汉字出现次数==>\n', cn_result) \ No newline at end of file diff --git a/exercises/1901100351/d09/mymodule/main.py b/exercises/1901100351/d09/mymodule/main.py deleted file mode 100644 index a4aebd832..000000000 --- a/exercises/1901100351/d09/mymodule/main.py +++ /dev/null @@ -1,39 +0,0 @@ -# this is d9 exercise for stander libirary - -# date: 2019.09.20; renewed 9.24 -# author by: rtgong - -import stats_word -from os import path -import json -import re -import logging - -logging.basicConfig( - format='file:%(filename)s|line:%(lineno)s|message:%(message)s',level=logging.DEBUG) - -def load_file():#定义文件路径 - file_path = path.join(path.dirname(path.abspath(__file__)), 'tang300.json') - print('当前文件路径',__file__,'\n读取文件路径:',file_path) - - with open(file_path,'r',encoding='UTF-8') as f: - return f.read() - -def merge_poems(data): - poems = '' - for item in data: - poems += item.get('contents','') - return poems - -def main(): - try: - data = load_file() - logging.info(data[0]) - poems = merge_poems(json.loads(data)) - logging.info('result==>%s',stats_word.stats_text_cn(poems,100)) - except Exception as e: - logging.exception(e) - -if __name__ == "__main__": - main() - diff --git a/exercises/1901100351/d09/mymodule/stats_word.py b/exercises/1901100351/d09/mymodule/stats_word.py deleted file mode 100644 index 19535cffd..000000000 --- a/exercises/1901100351/d09/mymodule/stats_word.py +++ /dev/null @@ -1,85 +0,0 @@ -# this is d9 exercise for stander libirary -# date: 2019.09.20 -# author by: rtgong - - -from collections import Counter - -# 统计参数中英文单词出现的次数,并按降序排列 -def stats_text_en(text, count): #定义函数 - elements = text.split() - words = [] - symbols = ',.!-*?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - #isascii() 表示如果字符串为空或者所有字母都是ASCII字符则返回True,否则返回False - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中汉字出现次数,并按降序排列 -def stats_text_cn(text, count): - cn_characters = [] - for character in text: - if '\u4e00'<= character <= '\u9fff':#中文字符的代码区间 - cn_characters.append(character) - return Counter(cn_characters).most_common(count) - - -# 合并英汉词频统计 -def stats_text(text,count) : - ''' - 合并英文词频 和 中文字频 的结果 - ''' - - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text,count) + stats_text_cn(text,count) - - - -en_text = ''' -the Zen of Python, by Tim Peters - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -cn_text = ''' -Python之禅 by Tim Peters - -优美胜于丑陋 -明了胜于晦涩 -简洁胜于复杂 -复杂胜于凌乱 -扁平胜于嵌套 -间隔胜于紧凑 -可读性很重要 -尽管实用会打破纯粹,也不可违背规则 -不要包容任何错误,除非你确定需要这样做 -当存在多种可能,不要尝试去猜测 -而是尽量找一种,最好是唯一一种明显的解决方案 -虽然这并不容易,因为你不是 Python 之父 -做也许好过不做,但不假思索就动手还不如不做 -如果你无法向人描述你的方案,那肯定不是一个好方案;反之亦然 -命名空间是一种绝妙的理念,请多加利用 -''' diff --git a/exercises/1901100351/d10/mymodule/main.py b/exercises/1901100351/d10/mymodule/main.py deleted file mode 100644 index e764c97c1..000000000 --- a/exercises/1901100351/d10/mymodule/main.py +++ /dev/null @@ -1,37 +0,0 @@ -# this is d10 exercise for using the third lib -# date: 2019.09.28 -# author by: rtgong - -import stats_word -from os import path -import json -import re -import logging - -logging.basicConfig( - format='file:%(filename)s|line:%(lineno)s|message:%(message)s',level=logging.DEBUG) - -def load_file():#定义文件路径 - file_path = path.join(path.dirname(path.abspath(__file__)), 'tang300.json') - print('当前文件路径',__file__,'\n读取文件路径:',file_path) - - with open(file_path,'r',encoding='UTF-8') as f: - return f.read() - -def merge_poems(data): - poems = '' - for item in data: - poems += item.get('contents','') - return poems - -def main(): - try: - data = load_file() - logging.info(data[0]) - poems = merge_poems(json.loads(data)) - print('前20汉字字频结果:',stats_word.stats_text_cn(poems,20)) - except Exception as e: - logging.exception(e) - -if __name__ == "__main__": - main() diff --git a/exercises/1901100351/d10/mymodule/stats_word.py b/exercises/1901100351/d10/mymodule/stats_word.py deleted file mode 100644 index f4f0a4bea..000000000 --- a/exercises/1901100351/d10/mymodule/stats_word.py +++ /dev/null @@ -1,45 +0,0 @@ -# this is d10 exercise for using the third lib -# date: 2019.09.28 -# author by: rtgong - -import collections -import re -import jieba -from collections import Counter - - -# 统计参数中英文单词出现的次数,并按降序排列 -def stats_text_en(text, count): #定义函数 - elements = text.split() - words = [] - symbols = ',.!-*?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - #isascii() 表示如果字符串为空或者所有字母都是ASCII字符则返回True,否则返回False - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中汉字出现次数,并按降序排列 -def stats_text_cn(text, count): - - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i)>1: - tmp.append(i) - return Counter(tmp).most_common(count) - - - -# 合并英汉词频统计 -def stats_text(text,count) : - ''' - 合并英文词频 和 中文字频 的结果 - ''' - - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text,count) + stats_text_cn(text,count) diff --git a/exercises/1901100351/d11/main.py b/exercises/1901100351/d11/main.py deleted file mode 100644 index 2353d229f..000000000 --- a/exercises/1901100351/d11/main.py +++ /dev/null @@ -1,35 +0,0 @@ -# this is d11 exercise for training -# date: 2019.10.1 -# author by: rtgong - -import yagmail -import requests -import pyquery -import getpass -import logging -from mymodule import stats_word - -logging.basicConfig(format='file:%(filename)s|line:%(lineno)s|message:%(message)s',level=logging.DEBUG) - -def get_article(): - r = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - document = pyquery.PyQuery(r.text) - return document('#js_content').text() - - -def main(): - try: - article = get_article() - result = stats_word.stats_text_cn(article,100) - logging.info('%s.%s',type(result),str(result)) - sender = input('请输入发件人邮箱:') - password = getpass.getpass('输入发件人邮箱授权码:') - recipients = input('请输入收件人邮箱:') - yag = yagmail.SMTP(sender,password, 'smtp.163.com') - yag.send(recipients,'1901100351 自学训练营20 rtgong',str(result)) - logging.info('已发送,请注意查收') - except Exception as e: - logging.exception(e) - -if __name__ == "__main__": - main() diff --git a/exercises/1901100351/d11/mymodule/stats_word.py b/exercises/1901100351/d11/mymodule/stats_word.py deleted file mode 100644 index 9f38b6766..000000000 --- a/exercises/1901100351/d11/mymodule/stats_word.py +++ /dev/null @@ -1,42 +0,0 @@ -# this is d11 exercise for training -# date: 2019.10.1 -# author by: rtgong - -import collections -import re -import jieba -from collections import Counter - -# 统计参数中英文单词出现的次数,并按降序排列 -def stats_text_en(text, count): #定义函数 - elements = text.split() - words = [] - symbols = ',.!-*?' - for element in elements: - for symbol in symbols: - element = element.replace(symbol,'') - #isascii() 表示如果字符串为空或者所有字母都是ASCII字符则返回True,否则返回False - if len(element) and element.isascii(): - words.append(element) - return Counter(words).most_common(count) - - -# 统计参数中汉字出现次数,并按降序排列 -def stats_text_cn(text, count): - words = jieba.cut(text) - tmp = [] - for i in words: - if len(i)>1: - tmp.append(i) - return Counter(tmp).most_common(count) - - -# 合并英汉词频统计 -def stats_text(text,count) : - ''' - 合并英文词频 和 中文字频 的结果 - ''' - - if not isinstance(text,str): - raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) - return stats_text_en(text,count) + stats_text_cn(text,count) diff --git a/exercises/1901100357/1001S02E01_helloworld.txt b/exercises/1901100357/1001S02E01_helloworld.txt deleted file mode 100644 index 76a760a36..000000000 --- a/exercises/1901100357/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -HOMEWORK 5.5 \ No newline at end of file diff --git a/exercises/1901100357/1001S02E02_hello_python.py b/exercises/1901100357/1001S02E02_hello_python.py deleted file mode 100644 index 599863043..000000000 --- a/exercises/1901100357/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print ("Hello World!") diff --git a/exercises/1901100357/1001S02E03_calculator.py b/exercises/1901100357/1001S02E03_calculator.py deleted file mode 100644 index f7909212d..000000000 --- a/exercises/1901100357/1001S02E03_calculator.py +++ /dev/null @@ -1,28 +0,0 @@ -def add(x, y): - print("adding {} and {}".format(x, y)) - return x + y - - -def subtract(x, y): - print("subtracting {} and {}".format(x, y)) - return x - y - - -def multipy(x, y): - print("multipying {} and {}".format(x, y)) - return x * y - - -def divide(x, y): - print("dividing {} and {}".format(x, y)) - return x / y - -a = add(1, 2) -s = subtract(2, 3) -m = multipy(3, 4) -d = divide(18, 3) - -print(a) -print(s) -print(m) -print(d) \ No newline at end of file diff --git a/exercises/1901100357/1001S02E04_control_flow.py b/exercises/1901100357/1001S02E04_control_flow.py deleted file mode 100644 index 77576323c..000000000 --- a/exercises/1901100357/1001S02E04_control_flow.py +++ /dev/null @@ -1,23 +0,0 @@ -# print times tables with for...in - - -for x in range(1,10): - for y in range(1, x+1): - print('%d*%d=%d'%(x, y, x*y), end='\t') - print('') - -# print times tables2 with while - -a = 0 -while a < 10: - a += 1 - if a%2 == 0: - continue - else: - b = 1 - while b < a+1: - print('%d*%d=%d'%(a, b, a*b), end='\t') - b += 1 - print('') - - diff --git a/exercises/1901100357/1001S02E05_array.py b/exercises/1901100357/1001S02E05_array.py deleted file mode 100644 index 631615e8c..000000000 --- a/exercises/1901100357/1001S02E05_array.py +++ /dev/null @@ -1,34 +0,0 @@ -# 翻转数组,拼接字符串,切片方式取出第三至八个字符,翻转字符串,转为int类型,转为2,8,16进制,输出三种结果 - -listhw = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - -# 翻转 -# list01 = reversed(listhw) -list011 = listhw[::-1] -# print(list011) -# print(list01) - -# 字符串 -list02 = [str(i) for i in list011] -# print(list02) -str01 =''.join(list02) -# print(str01) - -# 切片取出 -str02 = str01[2:8] -# print(str02) - -# 翻转字符串 -str03 = str02[::-1] -# print(str03) - -# int类型 -int01 = int(str03) -# print(int01) -int2 = bin(int01) -print(int2) -int8 = oct(int01) -print(int8) -int16 = hex(int01) -print(int16) -# print(type(int01), type(int2),type(int8),type(int16),type(str03)) \ No newline at end of file diff --git a/exercises/1901100357/1001S02E05_stats_text.py b/exercises/1901100357/1001S02E05_stats_text.py deleted file mode 100644 index a78c71533..000000000 --- a/exercises/1901100357/1001S02E05_stats_text.py +++ /dev/null @@ -1,41 +0,0 @@ -# 统计次数,从大到小排序 - -text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -import re -cutt = re.compile(r'[-.*,!]') -cuttext = cutt.sub('',text) -ltext = cuttext.lower() -glist = sorted(ltext.split(), key=str.lower) -# print(glist) - -from collections import Counter -counttext = Counter(glist) -# print(counttext) - -list1 = sorted(counttext.items(), key=lambda x:x[1], reverse=True) -print(list1) \ No newline at end of file diff --git a/exercises/1901100357/1001S02E05_string.py b/exercises/1901100357/1001S02E05_string.py deleted file mode 100644 index 224d027d2..000000000 --- a/exercises/1901100357/1001S02E05_string.py +++ /dev/null @@ -1,48 +0,0 @@ -# a-better换成worse,b-剔除含ea的单词,c-翻转大小写,d-单词按a-z排列并输出 - -text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -import re - -a = text.replace('better', 'worse') -# print(a) - -# import re -findb = re.compile(r'(\w*ea\w*)') #先写对象效率高 -b = findb.sub('', a) -# print(b) - -c = b.swapcase() -# print(c) - -cut = re.compile(r'[-.*,!]') -cutc = cut.sub('',c) -# print(cutc) -d1 = sorted(cutc.split(), key=str.lower) -st = '\t' -d = st.join(d1) -print(d) \ No newline at end of file diff --git a/exercises/1901100357/1001S02E06_stats_word.py b/exercises/1901100357/1001S02E06_stats_word.py deleted file mode 100644 index 691de15f3..000000000 --- a/exercises/1901100357/1001S02E06_stats_word.py +++ /dev/null @@ -1,44 +0,0 @@ -#coding:utf-8 -#统计英文词频 -def stats_text_en(text): - from collections import Counter - import re - cutt = re.compile(r'[-.*,!?]')#定义去除符号规则 - cuttext = cutt.sub('',text)#去除符号 - glist = sorted(cuttext.split(), key=str.lower)#单词生成数组并排序 - counttext = Counter(glist)#统计次数 - list1 = sorted(counttext.items(), key=lambda x:x[1], reverse=True)#词频排序 - print('统计数据为:', list1) - -# 以下为测试 -# a = 'I like apple, do you like apple?' -# stats_text_en(a) -# b = 'adjoahgod' -# stats_text_en(b) - -#统计中文词频 -def stats_text_cn(text): - - symbols =',。!?、()【】<>《》=:+-*—“”…'#定义需要去掉的字符 - - #去掉字符 - for i in symbols: - text = text.replace(i, '') - - counter = {} - #在字典里统计次数 - for j in text: - if j not in counter: - counter[j] = 1 - else: - counter[j] += 1 - - list1 = sorted(counter.items(), key=lambda x:x[1], reverse=True) - - # print('中文文字去符号 ==>', text) - # print('文字出现的次数 ==>', counter) - print('字频排序 ==>', list1) - -# 以下是测试 -# x = '如果你不觉得正则表达式很难读写的话,要么你是一个天才,要么,你不是地球人。正则表达式的语法很令人头疼,即使对经常使用它的人来说也是如此。由于难于读写,容易出错,所以找一种工具对正则表达式进行测试是很有必要的。' -# stats_text_cn(x) diff --git a/exercises/1901100357/README.md b/exercises/1901100357/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/exercises/1901100357/d07/mymodule/main.py b/exercises/1901100357/d07/mymodule/main.py deleted file mode 100644 index 47279143e..000000000 --- a/exercises/1901100357/d07/mymodule/main.py +++ /dev/null @@ -1,86 +0,0 @@ -text = ''' -愚公移⼭山 - -太⾏行行,王屋⼆二⼭山的北北⾯面,住了了⼀一個九⼗十歲的⽼老老翁,名叫愚公。⼆二⼭山佔地廣闊,擋住去路路,使他 -和家⼈人往來來極為不不便便。 - -⼀一天,愚公召集家⼈人說:「讓我們各盡其⼒力力,剷平⼆二⼭山,開條道路路,直通豫州,你們認為怎 -樣?」 -⼤大家都異異⼝口同聲贊成,只有他的妻⼦子表示懷疑,並說:「你連開鑿⼀一個⼩小丘的⼒力力量量都沒有,怎 -可能剷平太⾏行行、王屋⼆二⼭山呢?況且,鑿出的⼟土⽯石⼜又丟到哪裏去呢?」 - -⼤大家都熱烈烈地說:「把⼟土⽯石丟進渤海海裏。」 -於是愚公就和兒孫,⼀一起開挖⼟土,把⼟土⽯石搬運到渤海海去。 -愚公的鄰居是個寡婦,有個兒⼦子⼋八歲也興致勃勃地⾛走來來幫忙。 -寒來來暑往,他們要⼀一年年才能往返渤海海⼀一次。 - -住在⿈黃河河畔的智叟,看⾒見見他們這樣⾟辛苦,取笑愚公說:「你不不是很愚蠢嗎?你已⼀一把年年紀 -了了,就是⽤用盡你的氣⼒力力,也不不能挖去⼭山的⼀一⻆角呢?」 - -愚公歎息道:「你有這樣的成⾒見見,是不不會明⽩白的。你⽐比那寡婦的⼩小兒⼦子還不不如呢!就算我死 -了了,還有我的兒⼦子,我的孫⼦子,我的曾孫⼦子,他們⼀一直傳下去。⽽而這⼆二⼭山是不不會加⼤大的,總有 -⼀一天,我們會把它們剷平。」 - -智叟聽了了,無話可說: -⼆二⼭山的守護神被愚公的堅毅精神嚇倒,便便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤大 -⼒力力神揹⾛走⼆二⼭山。 - -How The Foolish Old Man Moved Mountains - -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. - -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” - -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. - -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. - -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. - -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. - -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed - -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” - -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. - -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. - -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' - - -# import stats_word as sw -# sw.stats_text(text) - -import stats_word -swt = stats_word.stats_text -swt(text) \ No newline at end of file diff --git a/exercises/1901100357/d07/mymodule/stats_word.py b/exercises/1901100357/d07/mymodule/stats_word.py deleted file mode 100644 index ef93b3283..000000000 --- a/exercises/1901100357/d07/mymodule/stats_word.py +++ /dev/null @@ -1,188 +0,0 @@ -#coding:utf-8 -# 统计参数中每个英文单词出现的次数 -# def stats_text_en(text): -# elements = text.split() -# words = [] -# symbols = ',.*-!?' -# for element in elements: -# for symbol in symbols: -# element = element.replace(symbol, '') -# if len(element): -# words.append(element) - -# counter = {} -# word_set = set(words) - -# for word in word_set: -# counter[word] = words.count(word) - -# return sorted(counter.items(), key=lambda x:x[1], reverse=True) - -def stats_text_en(text): - - elements = text.split() - words = [] - symbols = ',.*-!?' - for element in elements: - if (element >= '\u0041' and element <= '\u005A') or (element >= '\u0061' and element <= '\u007A'): - - # if len(element): - words.append(element) - - counter = {} - word_set = set(words) - - for word in word_set: - counter[word] = words.count(word) - - return sorted(counter.items(), key=lambda x:x[1], reverse=True) - - -# 统计参数中每个中文汉字出现的次数 -def stats_text_cn(text): - cn_characters = [] - for character in text: - # unicode中 中文字符的范围 - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - - counter = {} - cn_character_set = set(cn_characters) - - for character in cn_character_set: - counter[character] = cn_characters.count(character) - return sorted(counter.items(), key=lambda x:x[1], reverse=True) - -en_text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -cn_text = ''' -如果你不觉得正则表达式很难读写的话,要么你是一个天才,要么,你不是地球人。正则表达式的语法很令人头疼,即使对经常使用它的人来说也是如此。由于难于读写,容易出错,所以找一种工具对正则表达式进行测试是很有必要的。 -''' - -# 测试代码 -# if __name__ == '__main__': -# en_result = stats_text_en(en_text) -# cn_result = stats_text_cn(cn_text) -# print('英文单词出现的次数 ==>\n', en_result) -# print('中文汉字出现的次数 ==>\n', cn_result) - -text = ''' -愚公移⼭山 - -太⾏行行,王屋⼆二⼭山的北北⾯面,住了了⼀一個九⼗十歲的⽼老老翁,名叫愚公。⼆二⼭山佔地廣闊,擋住去路路,使他 -和家⼈人往來來極為不不便便。 - -⼀一天,愚公召集家⼈人說:「讓我們各盡其⼒力力,剷平⼆二⼭山,開條道路路,直通豫州,你們認為怎 -樣?」 -⼤大家都異異⼝口同聲贊成,只有他的妻⼦子表示懷疑,並說:「你連開鑿⼀一個⼩小丘的⼒力力量量都沒有,怎 -可能剷平太⾏行行、王屋⼆二⼭山呢?況且,鑿出的⼟土⽯石⼜又丟到哪裏去呢?」 - -⼤大家都熱烈烈地說:「把⼟土⽯石丟進渤海海裏。」 -於是愚公就和兒孫,⼀一起開挖⼟土,把⼟土⽯石搬運到渤海海去。 -愚公的鄰居是個寡婦,有個兒⼦子⼋八歲也興致勃勃地⾛走來來幫忙。 -寒來來暑往,他們要⼀一年年才能往返渤海海⼀一次。 - -住在⿈黃河河畔的智叟,看⾒見見他們這樣⾟辛苦,取笑愚公說:「你不不是很愚蠢嗎?你已⼀一把年年紀 -了了,就是⽤用盡你的氣⼒力力,也不不能挖去⼭山的⼀一⻆角呢?」 - -愚公歎息道:「你有這樣的成⾒見見,是不不會明⽩白的。你⽐比那寡婦的⼩小兒⼦子還不不如呢!就算我死 -了了,還有我的兒⼦子,我的孫⼦子,我的曾孫⼦子,他們⼀一直傳下去。⽽而這⼆二⼭山是不不會加⼤大的,總有 -⼀一天,我們會把它們剷平。」 - -智叟聽了了,無話可說: -⼆二⼭山的守護神被愚公的堅毅精神嚇倒,便便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤大 -⼒力力神揹⾛走⼆二⼭山。 - -How The Foolish Old Man Moved Mountains - -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. - -Stretching over a wide expanse of land, the mountains blocked -yugong’s way making it inconvenient for him and his family to get -around. -One day yugong gathered his family together and said,”Let’s do our -best to level these two mountains. We shall open a road that leads -to Yuzhou. What do you think?” - -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered -his wife. “How on earth do you suppose you can level Mount Taixin -and Mount Wanwu? Moreover, where will all the earth and rubble go?” -“Dump them into the Sea of Bohai!” said everyone. - -So Yugong, his sons, and his grandsons started to break up rocks and -remove the earth. They transported the earth and rubble to the Sea -of Bohai. - -Now Yugong’s neighbour was a widow who had an only child eight years -old. Evening the young boy offered his help eagerly. - -Summer went by and winter came. It took Yugong and his crew a full -year to travel back and forth once. - -On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed - -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never -understand. You can’t even compare with the widow’s little boy!” - -“Even if I were dead, there will still be my children, my -grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not -grow any taler. We shall level them one day!” he declared with -confidence. - -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong -and his crew were, they were struck with fear and reported the -incident to the Emperor of Heavens. - -Filled with admiration for Yugong, the Emperor of Heavens ordered -two mighty gods to carry the mountains away. -''' - -def stats_text(x): - # for a in y: - - # if (a >= '\u0041' and a <= '\u005A') or (a >= '\u0061' and a <= '\u007A'): - en_result = stats_text_en(x)#调用方程 - # elif '\u4e00' <= a <= '\u9fff': - cn_result = stats_text_cn(x)#调用方程 - - print('统计参数中每个英文单词出现的次数 ==>\n', en_result) - print('统计参数中每个中文汉字出现的次数 ==>\n', cn_result) - - -if __name__ == '__main__': - stats_text(text) -# if __name__ == '__main__': -# stats_text(cn_text) - diff --git a/exercises/1901100362/07/main.py b/exercises/1901100362/07/main.py deleted file mode 100644 index 706348fc4..000000000 --- a/exercises/1901100362/07/main.py +++ /dev/null @@ -1,68 +0,0 @@ -from mymodule import stats_word - -text = ''' -愚公移⼭山 -太⾏行行,王屋⼆二⼭山的北北⾯面,住了了⼀一個九⼗十歲的⽼老老翁,名叫愚公。⼆二⼭山佔地廣闊,擋住去路路,使他 -和家⼈人往來來極為不不便便。 -⼀一天,愚公召集家⼈人說:「讓我們各盡其⼒力力,剷平⼆二⼭山,開條道路路,直通豫州,你們認為怎 -樣?」 -⼤大家都異異⼝口同聲贊成,只有他的妻⼦子表示懷疑,並說:「你連開鑿⼀一個⼩小丘的⼒力力量量都沒有,怎 -可能剷平太⾏行行、王屋⼆二⼭山呢?況且,鑿出的⼟土⽯石⼜又丟到哪裏去呢?」 -⼤大家都熱烈烈地說:「把⼟土⽯石丟進渤海海裏。」 -於是愚公就和兒孫,⼀一起開挖⼟土,把⼟土⽯石搬運到渤海海去。 -愚公的鄰居是個寡婦,有個兒⼦子⼋八歲也興致勃勃地⾛走來來幫忙。 -寒來來暑往,他們要⼀一年年才能往返渤海海⼀一次。 -住在⿈黃河河畔的智叟,看⾒見見他們這樣⾟辛苦,取笑愚公說:「你不不是很愚蠢嗎?你已⼀一把年年紀 -了了,就是⽤用盡你的氣⼒力力,也不不能挖去⼭山的⼀一⻆角呢?」 -愚公歎息道:「你有這樣的成⾒見見,是不不會明⽩白的。你⽐比那寡婦的⼩小兒⼦子還不不如呢!就算我死 -了了,還有我的兒⼦子,我的孫⼦子,我的曾孫⼦子,他們⼀一直傳下去。⽽而這⼆二⼭山是不不會加⼤大的,總有 -⼀一天,我們會把它們剷平。」 -智叟聽了了,無話可說: -⼆二⼭山的守護神被愚公的堅毅精神嚇倒,便便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤大 -⼒力力神揹⾛走⼆二⼭山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked - yugong’s way making it inconvenient for him and his family to get - around. -One day yugong gathered his family together and said,”Let’s do our - best to level these two mountains. We shall open a road that leads - to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered - his wife. “How on earth do you suppose you can level Mount Taixin - and Mount Wanwu? Moreover, where will all the earth and rubble go?” - “Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and - remove the earth. They transported the earth and rubble to the Sea - of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years - old. Evening the young boy offered his help eagerly. - Summer went by and winter came. It took Yugong and his crew a full - year to travel back and forth once. - On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never - understand. You can’t even compare with the widow’s little boy!” - “Even if I were dead, there will still be my children, my - grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not - grow any taler. We shall level them one day!” he declared with - confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong - and his crew were, they were struck with fear and reported the - incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered - two mighty gods to carry the mountains away. -''' - - -if __name__ == '__main__': - - result = stats_word.stats_text(text) - print(result) \ No newline at end of file diff --git a/exercises/1901100362/07/mymodule/stats_word.py b/exercises/1901100362/07/mymodule/stats_word.py deleted file mode 100644 index e82e799e4..000000000 --- a/exercises/1901100362/07/mymodule/stats_word.py +++ /dev/null @@ -1,68 +0,0 @@ -#统计参数中每个英文单词出现的次数 -import string - - -def stats_text_en(words): - - - - #初始化一个counter字典,用来存放单词出现的频次 - counter = {} - - #去重,减少迭代次数 - word_set = set(words) - - for word in word_set: - counter[word] = words.count(word) - - #2.从小到大排序输出 - - return sorted(counter.items(), key = lambda x:x[1],reverse=True) - -#统计参数中每个中文字符出现的次数 -def stats_text_cn(words): - str_words = ''.join(words) - set_words = set(str_words) - - counter = {} - - for ch in set_words: - counter[ch] = str_words.count(ch) - return sorted(counter.items(),key = lambda x:x[1],reverse=True) - -def stats_text(text): - - symbols = ',。:「」,?.”、-!' - for symbol in symbols: - text = text.replace(symbol,' ') - l1 = text.split() - en_text = [] - cn_text = [] - for i in l1: - if len(i)>0: - if i[0] in string.ascii_letters: - en_text.append(i) - else: - cn_text.append(i) - - cn_result = stats_text_cn(cn_text) - en_result = stats_text_en(en_text) - merged_result = cn_result+en_result - return (merged_result) - - - - - - - - - - - - - - - - - diff --git a/exercises/1901100362/08/main.py b/exercises/1901100362/08/main.py deleted file mode 100644 index dfd02635a..000000000 --- a/exercises/1901100362/08/main.py +++ /dev/null @@ -1,92 +0,0 @@ -from mymodule import stats_word -import traceback -import logging - -""" -text = ''' -愚公移⼭山 -太⾏行行,王屋⼆二⼭山的北北⾯面,住了了⼀一個九⼗十歲的⽼老老翁,名叫愚公。⼆二⼭山佔地廣闊,擋住去路路,使他 -和家⼈人往來來極為不不便便。 -⼀一天,愚公召集家⼈人說:「讓我們各盡其⼒力力,剷平⼆二⼭山,開條道路路,直通豫州,你們認為怎 -樣?」 -⼤大家都異異⼝口同聲贊成,只有他的妻⼦子表示懷疑,並說:「你連開鑿⼀一個⼩小丘的⼒力力量量都沒有,怎 -可能剷平太⾏行行、王屋⼆二⼭山呢?況且,鑿出的⼟土⽯石⼜又丟到哪裏去呢?」 -⼤大家都熱烈烈地說:「把⼟土⽯石丟進渤海海裏。」 -於是愚公就和兒孫,⼀一起開挖⼟土,把⼟土⽯石搬運到渤海海去。 -愚公的鄰居是個寡婦,有個兒⼦子⼋八歲也興致勃勃地⾛走來來幫忙。 -寒來來暑往,他們要⼀一年年才能往返渤海海⼀一次。 -住在⿈黃河河畔的智叟,看⾒見見他們這樣⾟辛苦,取笑愚公說:「你不不是很愚蠢嗎?你已⼀一把年年紀 -了了,就是⽤用盡你的氣⼒力力,也不不能挖去⼭山的⼀一⻆角呢?」 -愚公歎息道:「你有這樣的成⾒見見,是不不會明⽩白的。你⽐比那寡婦的⼩小兒⼦子還不不如呢!就算我死 -了了,還有我的兒⼦子,我的孫⼦子,我的曾孫⼦子,他們⼀一直傳下去。⽽而這⼆二⼭山是不不會加⼤大的,總有 -⼀一天,我們會把它們剷平。」 -智叟聽了了,無話可說: -⼆二⼭山的守護神被愚公的堅毅精神嚇倒,便便把此事奏知天帝。天帝佩服愚公的精神,就命兩位⼤大 -⼒力力神揹⾛走⼆二⼭山。 -How The Foolish Old Man Moved Mountains -Yugong was a ninety-year-old man who lived at the north of two high -mountains, Mount Taixing and Mount Wangwu. -Stretching over a wide expanse of land, the mountains blocked - yugong’s way making it inconvenient for him and his family to get - around. -One day yugong gathered his family together and said,”Let’s do our - best to level these two mountains. We shall open a road that leads - to Yuzhou. What do you think?” -All but his wife agreed with him. -“You don’t have the strength to cut even a small mound,” muttered - his wife. “How on earth do you suppose you can level Mount Taixin - and Mount Wanwu? Moreover, where will all the earth and rubble go?” - “Dump them into the Sea of Bohai!” said everyone. -So Yugong, his sons, and his grandsons started to break up rocks and - remove the earth. They transported the earth and rubble to the Sea - of Bohai. -Now Yugong’s neighbour was a widow who had an only child eight years - old. Evening the young boy offered his help eagerly. - Summer went by and winter came. It took Yugong and his crew a full - year to travel back and forth once. - On the bank of the Yellow River dwelled an old man much respected -for his wisdom. When he saw their back-breaking labour, he ridiculed -Yugong saying,”Aren’t you foolish, my friend? You are very old now, -and with whatever remains of your waning strength, you won’t be able -to remove even a corner of the mountain.” -Yugong uttered a sigh and said,”A biased person like you will never - understand. You can’t even compare with the widow’s little boy!” - “Even if I were dead, there will still be my children, my - grandchildren, my great grandchildren, my great great grandchildren. -They descendants will go on forever. But these mountains will not - grow any taler. We shall level them one day!” he declared with - confidence. -The wise old man was totally silenced. -When the guardian gods of the mountains saw how determined Yugong - and his crew were, they were struck with fear and reported the - incident to the Emperor of Heavens. -Filled with admiration for Yugong, the Emperor of Heavens ordered - two mighty gods to carry the mountains away. -''' -""" -text = 1 - -def test_traceback(): - try: - stats_word.stats_text(text) - except Exception as e: - print("trace_back==>",e) - print(traceback.format_exc()) -def test_logger(): - try: - stats_word.stats_text(text) - except Exception as e: - logging.exception(e) - - -if __name__ == '__main__': - test_traceback() - test_logger() - - -# result = stats_word.stats_text(text) -# en_result = stats_word.stats_text_en(text) -# cn_result = stats_word.stats_text_cn(text) -# print(result) - - diff --git a/exercises/1901100362/08/mymodule/stats_word.py b/exercises/1901100362/08/mymodule/stats_word.py deleted file mode 100644 index 70f43f3cd..000000000 --- a/exercises/1901100362/08/mymodule/stats_word.py +++ /dev/null @@ -1,84 +0,0 @@ -#统计参数中每个英文单词出现的次数 -import string - - -def stats_text_en(words): -# if type(words) != str: - if not isinstance(words,str): - raise ValueError("参数必须是字符串 %s" % type(words)) - - - #初始化一个counter字典,用来存放单词出现的频次 - counter = {} - - #去重,减少迭代次数 - - word_set = set(words) - for word in word_set: - counter[word] = words.count(word) - - - #2.从小到大排序输出 - - return sorted(counter.items(), key = lambda x:x[1],reverse=True) - -#统计参数中每个中文字符出现的次数 -def stats_text_cn(words): - - if type(words) != str: - raise ValueError("参数必须是字符串 %s" % type(text)) - - - str_words = ''.join(words) - set_words = set(str_words) - counter = {} - - for ch in set_words: - counter[ch] = str_words.count(ch) - return sorted(counter.items(),key = lambda x:x[1],reverse=True) - - - - - -def stats_text(text): - - if type(text) != str: - raise ValueError("请输入字符串!") - - symbols = ',。:「」,?.”、-!' - l1 = [] - for symbol in symbols: - text = text.replace(symbol,' ') - l1 = text.split() - - en_text = [] - cn_text = [] - for i in l1: - if len(i)>0: - if i[0] in string.ascii_letters: - en_text.append(i) - else: - cn_text.append(i) - - cn_result = stats_text_cn(cn_text) - en_result = stats_text_en(en_text) - merged_result = cn_result+en_result - return (merged_result) - - - - - - - - - - - - - - - - - diff --git a/exercises/1901100362/09/main.py b/exercises/1901100362/09/main.py deleted file mode 100644 index a28b4a39b..000000000 --- a/exercises/1901100362/09/main.py +++ /dev/null @@ -1,28 +0,0 @@ -from mymodule import stats_word -import traceback -import logging -import json -import os - -def test_traceback(): - try: - stats_word.stats_text(text) - except Exception as e: - print("trace_back==>",e) - print(traceback.format_exc()) -def test_logger(): - try: - stats_word.stats_text(text) - except Exception as e: - logging.exception(e) - - -if __name__ == '__main__': -# test_traceback() -# test_logger() -# print(stats_word.stats_text(text)) - filename = 'tang300.json' - filedir = os.path.dirname(os.path.realpath(__file__)) - with open(filedir+'/'+filename) as f: - f1 = f.read() - print(stats_word.stats_text_cn(f1,100)) \ No newline at end of file diff --git a/exercises/1901100362/09/mymodule/stats_word.py b/exercises/1901100362/09/mymodule/stats_word.py deleted file mode 100644 index f774a61c1..000000000 --- a/exercises/1901100362/09/mymodule/stats_word.py +++ /dev/null @@ -1,72 +0,0 @@ -#统计参数中每个英文单词出现的次数 -import string -from collections import Counter - - -def stats_text_en(text,count): - if not isinstance(text,str): - raise ValueError("text参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - - elements = text.split() - words = [] - symbols = ',.*-!' - - for element in elements: - for symbol in symbols: - element.replace(symbol,' ') - if len(element) and element.isascii(): - words.append(element) - - - - counter = Counter(words).most_common(count) - - return sorted(dict(counter).items(), key = lambda x:x[1],reverse=True) - -#统计参数中每个中文字符出现的次数 -def stats_text_cn(text,count): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - - cn_characters = [] - for character in text: - if '\u4e00'<=character<='\u9fff': - cn_characters.append(character) - - - counter = Counter(cn_characters).most_common(count) - - return sorted(dict(counter).items(),key = lambda x:x[1],reverse=True) - - - - - -def stats_text(text): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - - return stats_text_cn(text,10) + stats_text_en(text,10) - - - - - - - - - - - - - - - - - diff --git a/exercises/1901100362/10/main.py b/exercises/1901100362/10/main.py deleted file mode 100644 index c94fc31f2..000000000 --- a/exercises/1901100362/10/main.py +++ /dev/null @@ -1,28 +0,0 @@ -from mymodule import stats_word -import traceback -import logging -import json -import os - -def test_traceback(): - try: - stats_word.stats_text(text) - except Exception as e: - print("trace_back==>",e) - print(traceback.format_exc()) -def test_logger(): - try: - stats_word.stats_text(text) - except Exception as e: - logging.exception(e) - - -if __name__ == '__main__': -# test_traceback() -# test_logger() -# print(stats_word.stats_text(text)) - filename = 'tang300.json' - filedir = os.path.dirname(os.path.realpath(__file__)) - with open(filedir+'/'+filename) as f: - f1 = f.read() - print(stats_word.stats_text_cn(f1,20)) \ No newline at end of file diff --git a/exercises/1901100362/10/mymodule/stats_word.py b/exercises/1901100362/10/mymodule/stats_word.py deleted file mode 100644 index e405b67b2..000000000 --- a/exercises/1901100362/10/mymodule/stats_word.py +++ /dev/null @@ -1,79 +0,0 @@ -#统计参数中每个英文单词出现的次数 -#encoding = utf-8 -import string -from collections import Counter -import jieba - - -def stats_text_en(text,count): - if not isinstance(text,str): - raise ValueError("text参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - - elements = text.split() - words = [] - symbols = ',.*-!' - - for element in elements: - for symbol in symbols: - element.replace(symbol,' ') - if len(element) and element.isascii(): - words.append(element) - - - - counter = Counter(words).most_common(count) - - return sorted(dict(counter).items(), key = lambda x:x[1],reverse=True) - -#统计参数中每个中文字符出现的次数 -def stats_text_cn(text,count): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - -# s1 = ' '.join(seg_list)) # 精确模式 - - cn_characters = [] - for character in text: - if '\u4e00'<=character<='\u9fff': - cn_characters.append(character) - s1 = ''.join(cn_characters) - #print(s1) - seg_list = [ element for element in jieba.cut(s1, cut_all=False) if len(element)>2] - - - counter = Counter(seg_list).most_common(count) - - return sorted(dict(counter).items(),key = lambda x:x[1],reverse=True) - - - - - -def stats_text(text): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - - return stats_text_cn(text,10) + stats_text_en(text,10) - - - - - - - - - - - - - - - - - diff --git a/exercises/1901100362/1001S02E05_string.py b/exercises/1901100362/1001S02E05_string.py index 9f7dc2e8b..731308d38 100644 --- a/exercises/1901100362/1001S02E05_string.py +++ b/exercises/1901100362/1001S02E05_string.py @@ -22,7 +22,7 @@ #把better替换成worse t1 = text.replace('better','worse') -print("将所有better替换成worse==>",t1) +print(t1) print("-------------------------------------------------------------------------------") #删除字符串中的带ea的单词 diff --git a/exercises/1901100362/11/main.py b/exercises/1901100362/11/main.py deleted file mode 100644 index 0a077f48a..000000000 --- a/exercises/1901100362/11/main.py +++ /dev/null @@ -1,89 +0,0 @@ -from mymodule import stats_word -import traceback -import logging -import json -from os import path -import yagmail -from pyquery import PyQuery -import requests -import getpass - -def test_traceback(): - try: - stats_word.stats_text(text) - except Exception as e: - print("trace_back==>",e) - print(traceback.format_exc()) -def test_logger(): - try: - stats_word.stats_text(text) - except Exception as e: - logging.exception(e) - - -def load_file(): - - file_path = path.join(path.dirname(path.abspath(__file__)),'tang300.json') - print("当前文件路径==>",__file__,'\n读取文件路径==>',file_path) - ''' - tang300.json在上一级目录 - file_path = path.join(path.dirname(path.abspath(__file__)),'../tang300.json') - - tang300.json文件在上一级目录的data目录下的文件 - file_path = path.join(path.dirname(path.abspath(__file__)),'../data/tang300.json') - ''' - - with open(file_path,'r',encoding='utf-8') as f: - return f.read() - -#data为由json转换而来的字典 -def merge_poems(data): - poems = '' - for item in data: - poems +=item.get('contents','') - return poems - -def read_page(url): - response = requests.get(url) -# print(response.headers['content-type']) - document = PyQuery(response.text) - content = document('#js_content').text() - return stats_word.stats_text_cn(content,100) -def send_mail(content): - username = input('请输入邮件账号:') - passwd = input('请输入授权码:') - mail = yagmail.SMTP(user=username, - password=passwd, - host='smtp.163.com', - # smtp_ssl=True - ) #如果用的是qq邮箱或者你们公司的邮箱使用是安全协议的话,必须写上 smtp_ssl=True - mail.send( - to='pythoncamp@163.com', #如果多个收件人的话,写成list. - cc='13910255158@163.com',#抄送 - subject='张小龙',#邮件标题 - contents = content)#邮件正文 - # attachments=[r'C:\Users\Desktop\a.txt', - # r'C:\pp\b.txt'])#附件如果只有一个的话,用字符串就行,attachments=r'C:\\pp\\b.txt' - - -def main(): - try: - data = load_file() - logging.info(data[0]) - poems = merge_poems(json.loads(data)) - - logging.info('result ==> %s',stats_word.stats_text_cn(poems,100)) - print(stats_word.stats_text_cn(poems,20)) - except Exception as e: - logging.exception(e) - - -if __name__ == '__main__': -# test_traceback() -# test_logger() -# print(stats_word.stats_text(text)) -# main() - url = 'https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA' - contents = json.dumps(dict(read_page(url)),ensure_ascii=False) - send_mail(contents) - diff --git a/exercises/1901100362/11/mymodule/stats_word.py b/exercises/1901100362/11/mymodule/stats_word.py deleted file mode 100644 index d10158335..000000000 --- a/exercises/1901100362/11/mymodule/stats_word.py +++ /dev/null @@ -1,74 +0,0 @@ -#统计参数中每个英文单词出现的次数 -#encoding = utf-8 -import string -from collections import Counter -import jieba - - -def stats_text_en(text,count): - if not isinstance(text,str): - raise ValueError("text参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - - elements = text.split() - words = [] - symbols = ',.*-!' - - for element in elements: - for symbol in symbols: - element.replace(symbol,' ') - if len(element) and element.isascii(): - words.append(element) - - return Counter(words).most_common(count) - -#统计参数中每个中文字符出现的次数 -def stats_text_cn(text,count): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - -# s1 = ' '.join(seg_list)) # 精确模式 - - cn_characters = [] - for character in text: - if '\u4e00'<=character<='\u9fff': - cn_characters.append(character) - s1 = ''.join(cn_characters) - seg_list = [ element for element in jieba.cut(s1, cut_all=False) if len(element)>2] - - return Counter(seg_list).most_common(count) - - - - - - -def stats_text(text,count): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - - return stats_text_cn(text,count) + stats_text_en(text,count) - - - - - - - - - - - - - - - - - diff --git a/exercises/1901100362/12/main.py b/exercises/1901100362/12/main.py deleted file mode 100644 index 72a17632d..000000000 --- a/exercises/1901100362/12/main.py +++ /dev/null @@ -1,43 +0,0 @@ -import traceback -import requests -from mymodule import stats_word -from pyquery import PyQuery -from wxpy import * - - -def test_traceback(): - try: - stats_word.stats_text(text) - except Exception as e: - print("trace_back==>",e) - print(traceback.format_exc()) -def test_logger(): - try: - stats_word.stats_text(text) - except Exception as e: - logging.exception(e) - -def main(): - try: - bot = Bot() - my_friend = bot.my_friends() - - @bot.register(my_friend,SHARING) - def auto_reply(msg): - response = requests.get(msg.url) - document = PyQuery(response.text) - content = document('#js_content').text() - result = stats_word.stats_text_cn(content,10) - return result - - except Exception as e: - logging.exception(e) - - -if __name__ == '__main__': -# test_traceback() -# test_logger() -# print(stats_word.stats_text(text)) - main() - - diff --git a/exercises/1901100362/12/mymodule/stats_word.py b/exercises/1901100362/12/mymodule/stats_word.py deleted file mode 100644 index 728d19ff7..000000000 --- a/exercises/1901100362/12/mymodule/stats_word.py +++ /dev/null @@ -1,74 +0,0 @@ -#统计参数中每个英文单词出现的次数 -#encoding = utf-8 -import string -from collections import Counter -from jieba import cut - - -def stats_text_en(text,count): - if not isinstance(text,str): - raise ValueError("text参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - - elements = text.split() - words = [] - symbols = ',.*-!' - - for element in elements: - for symbol in symbols: - element.replace(symbol,' ') - if len(element) and element.isascii(): - words.append(element) - - return Counter(words).most_common(count) - -#统计参数中每个中文字符出现的次数 -def stats_text_cn(text,count): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - -# s1 = ' '.join(seg_list)) # 精确模式 - - cn_characters = [] - for character in text: - if '\u4e00'<=character<='\u9fff': - cn_characters.append(character) - s1 = ''.join(cn_characters) - seg_list = [element for element in cut(s1, cut_all=False) if len(element) > 2] - - return Counter(seg_list).most_common(count) - - - - - - -def stats_text(text,count): - - if not isinstance(text,str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count,int): - raise ValueError("count参数必须是int %d" % type(count)) - - return stats_text_cn(text,count) + stats_text_en(text,count) - - - - - - - - - - - - - - - - - diff --git a/exercises/1901100362/13/main.py b/exercises/1901100362/13/main.py deleted file mode 100644 index e0dcb7b59..000000000 --- a/exercises/1901100362/13/main.py +++ /dev/null @@ -1,104 +0,0 @@ -from matplotlib import rcParams -from mymodule import stats_word -import traceback -import logging -import json -from os import path -import yagmail -from pyquery import PyQuery -import requests -import matplotlib.pyplot as plt -from wxpy import * -import numpy as np -from pylab import mpl - - -def test_traceback(): - try: - stats_word.stats_text(text) - except Exception as e: - print("trace_back==>", e) - print(traceback.format_exc()) - - -def test_logger(): - try: - stats_word.stats_text(text) - except Exception as e: - logging.exception(e) - - -def load_file(): - file_path = path.join(path.dirname(path.abspath(__file__)), 'tang300.json') - print("当前文件路径==>", __file__, '\n读取文件路径==>', file_path) - ''' - tang300.json在上一级目录 - file_path = path.join(path.dirname(path.abspath(__file__)),'../tang300.json') - - tang300.json文件在上一级目录的data目录下的文件 - file_path = path.join(path.dirname(path.abspath(__file__)),'../data/tang300.json') - ''' - - with open(file_path, 'r', encoding='utf-8') as f: - return f.read() - - -# data为由json转换而来的字典 -def merge_poems(data): - poems = '' - for item in data: - poems += item.get('contents', '') - return poems - - -def get_article(): - r = requests.get('https://mp.weixin.qq.com/s/pLmuGoc4bZrMNl7MSoWgiA') - document = PyQuery(r.text) - return document('#js_content').text() - - -def main(): - try: - ''' - bot = Bot() - my_friend = bot.my_friends() - - @bot.register(my_friend,SHARING) - def auto_reply(msg): - response = requests.get(msg.url) - document = PyQuery(response.text) - content = document('#js_content').text() - ''' - article = get_article() - result = stats_word.stats_text_cn(article, 10) - - np_list = np.array(result) - word_list = [] - number_list = [] - - for i in range(len(np_list)): - word_list += [np_list[i][0]] - number_list += [int(np_list[i][1])] - - plt.rcdefaults() - - plt.rcParams['font.sans-serif'] = ['Arial Unicode MS'] - # plt.rcParams['axes.unicode_minus'] = False - fig,ax = plt.subplots() - y_pos = np.arange(len(word_list)) - - ax.barh(y_pos, number_list, align='center') - ax.set_yticks(y_pos) - ax.set_yticklabels(word_list) - ax.invert_yaxis() - ax.set_xlabel('计数') - ax.set_title('词频统计') - # plt.savefig("stats.png") - plt.show() - - embed() - - except Exception as e: - logging.exception(e) -if __name__ == '__main__': - main() diff --git a/exercises/1901100362/13/mymodule/stats_word.py b/exercises/1901100362/13/mymodule/stats_word.py deleted file mode 100644 index 834d0533f..000000000 --- a/exercises/1901100362/13/mymodule/stats_word.py +++ /dev/null @@ -1,52 +0,0 @@ -# 统计参数中每个英文单词出现的次数 -# encoding = utf-8 -import string -from collections import Counter -import jieba - - -def stats_text_en(text, count): - if not isinstance(text, str): - raise ValueError("text参数必须是字符串 %s" % type(text)) - elif not isinstance(count, int): - raise ValueError("count参数必须是int %d" % type(count)) - - elements = text.split() - words = [] - symbols = ',.*-!' - - for element in elements: - for symbol in symbols: - element.replace(symbol, ' ') - if len(element) and element.isascii(): - words.append(element) - - return Counter(words).most_common(count) - - -# 统计参数中每个中文字符出现的次数 -def stats_text_cn(text, count): - if not isinstance(text, str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count, int): - raise ValueError("count参数必须是int %d" % type(count)) - - # s1 = ' '.join(seg_list)) # 精确模式 - - cn_characters = [] - for character in text: - if '\u4e00' <= character <= '\u9fff': - cn_characters.append(character) - s1 = ''.join(cn_characters) - seg_list = [element for element in jieba.cut(s1, cut_all=False) if len(element) > 2] - - return Counter(seg_list).most_common(count) - - -def stats_text(text, count): - if not isinstance(text, str): - raise ValueError("参数必须是字符串 %s" % type(text)) - elif not isinstance(count, int): - raise ValueError("count参数必须是int %d" % type(count)) - - return stats_text_cn(text, count) + stats_text_en(text, count) diff --git a/exercises/1901100366/1001S02E02_hello_python.py/workspace/hello_world.py b/exercises/1901100366/1001S02E02_hello_python.py/workspace/hello_world.py deleted file mode 100644 index 00950d9ac..000000000 --- a/exercises/1901100366/1001S02E02_hello_python.py/workspace/hello_world.py +++ /dev/null @@ -1 +0,0 @@ -print('hello world') \ No newline at end of file diff --git a/exercises/1901100370/1001S02E03_calculator.py b/exercises/1901100370/1001S02E03_calculator.py deleted file mode 100644 index fb7c04a1a..000000000 --- a/exercises/1901100370/1001S02E03_calculator.py +++ /dev/null @@ -1,23 +0,0 @@ -operation=input("请输入运算符号:+,-,*,/") -print("请输入第一个数字") -a=input() -x=int(a) -print("请输入第二个数字") -b=input() -y=int(b) -print("它们的结果等于多少?") -if operation=="+": - print(x,+'+',y,'=',x+y) -elif operation=="-": - print(x,"-",y,'=',x-y) -elif operation=='*': - print(x,'*',y,'=',x*y) -elif operation=='/': - print(x,'/',y,'=',x/y) -else: - print("您的输入有误") - - - - - diff --git a/exercises/1901100370/1001S02E04_control_flow.py b/exercises/1901100370/1001S02E04_control_flow.py deleted file mode 100644 index 2536f543c..000000000 --- a/exercises/1901100370/1001S02E04_control_flow.py +++ /dev/null @@ -1,16 +0,0 @@ -print('打印九九乘法表') -for x in range(1,10): - for y in range(1,x+1): - print(x,'*',y,'=',x*y,end='\t') - print() - print() -print('打印奇数行的乘法表') -x=1 -while x<10: - if x%2==0: - print() - print() - else: - for y in range(1,x+1): - print(x,'*',y,'=',x*y,end='\t') - x=x+1 \ No newline at end of file diff --git a/exercises/1901100372/1001S02E01_helloworld.txt b/exercises/1901100372/1001S02E01_helloworld.txt deleted file mode 100644 index 87bea4d1a..000000000 --- a/exercises/1901100372/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -ҹ˼ \ No newline at end of file diff --git a/exercises/1901100372/1001S02E02_hello_python.py b/exercises/1901100372/1001S02E02_hello_python.py deleted file mode 100644 index 629506d2c..000000000 --- a/exercises/1901100372/1001S02E02_hello_python.py +++ /dev/null @@ -1,2 +0,0 @@ -a="hello"+"world" -print(a) \ No newline at end of file diff --git a/exercises/1901100372/README.md b/exercises/1901100372/README.md deleted file mode 100644 index 7058982c6..000000000 --- a/exercises/1901100372/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# hello-world -task for the first day diff --git a/exercises/1901100373/1001S02E01_helloworld.txt b/exercises/1901100373/1001S02E01_helloworld.txt deleted file mode 100644 index 9fd1d7d9b..000000000 --- a/exercises/1901100373/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -a start \ No newline at end of file diff --git a/exercises/1901100373/1001S02E02_hello_python.py b/exercises/1901100373/1001S02E02_hello_python.py deleted file mode 100644 index 8cde7829c..000000000 --- a/exercises/1901100373/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print("hello world") diff --git a/exercises/1901100373/readme b/exercises/1901100373/readme deleted file mode 100644 index add15d29b..000000000 --- a/exercises/1901100373/readme +++ /dev/null @@ -1,7 +0,0 @@ -# Day1学习心得 -今天用了3个多小时的时间掌握了Github的基本用法,还需要对markdown的使用多一些了解。 - -# Day2学习心得 -配置Python运行的各种环境花了不少时间,是因为之前从未有过相关经验,缺少背景技术积累,所有内容都需要从头学起。 -环境配置完成后试着写print程序,这一步倒不是很复杂,但是在使用mac os自带的terminal运行时却碰到了python: can't open file in macbook terminal - [Errno 2]!的问题。 -Google了一下才发现是python文件没有存放在命令执行所对应的文件夹,于是又尝试学习pwd和cd命令,最终解决了问题。 \ No newline at end of file diff --git a/exercises/1901100375/1001S02E01_helloworld.txt b/exercises/1901100375/1001S02E01_helloworld.txt deleted file mode 100644 index 8d68c0b23..000000000 --- a/exercises/1901100375/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -day 1 assignment by Sally-luo diff --git a/exercises/1901100375/1001S02E02_hello_python.py b/exercises/1901100375/1001S02E02_hello_python.py deleted file mode 100644 index 41d837c79..000000000 --- a/exercises/1901100375/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print("hello,world!") \ No newline at end of file diff --git a/exercises/1901100375/README.md b/exercises/1901100375/README.md deleted file mode 100644 index e0abb0077..000000000 --- a/exercises/1901100375/README.md +++ /dev/null @@ -1 +0,0 @@ -# 学习心得 diff --git a/exercises/1901100376/1001S02E01_helloworld.txt b/exercises/1901100376/1001S02E01_helloworld.txt deleted file mode 100644 index 9daeafb98..000000000 --- a/exercises/1901100376/1001S02E01_helloworld.txt +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/exercises/1901100376/1001S02E02_hello_python.py b/exercises/1901100376/1001S02E02_hello_python.py deleted file mode 100644 index 75d9766db..000000000 --- a/exercises/1901100376/1001S02E02_hello_python.py +++ /dev/null @@ -1 +0,0 @@ -print('hello world') diff --git a/exercises/1901100376/README.md b/exercises/1901100376/README.md deleted file mode 100644 index b40e1d129..000000000 --- a/exercises/1901100376/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Github Account: GS2017GS gs121500190@gmail.com - -Student Numeber: 1901100376 - - diff --git a/exercises/190110304/1001S02E02_hello_python.py b/exercises/190110304/1001S02E02_hello_python.py index 5a68b6a56..e75154b7c 100644 --- a/exercises/190110304/1001S02E02_hello_python.py +++ b/exercises/190110304/1001S02E02_hello_python.py @@ -1,12 +1 @@ - -i = 1 -while i < 10: - j = 1 - while j < i + 1: - if i%2 == 0: - break - print(j, '*', i, '=', i * j, sep='', end='\t') - j += 1 - - print() - +print("hello world") \ No newline at end of file diff --git a/exercises/190110304/1001S02E05_array.py b/exercises/190110304/1001S02E05_array.py deleted file mode 100644 index 8001d59d9..000000000 --- a/exercises/190110304/1001S02E05_array.py +++ /dev/null @@ -1,19 +0,0 @@ -a=[0,1, 2, 3, 4, 5, 6, 7, 8, 9] -a=a[::-1]#将数组反转 -print(a) -str = ''.join(str(i) for i in a) #将数组转换成字串符 -print(str) - -b=str[2:8] #⽤字符串切⽚的⽅式取出第三到第⼋个字符 -print(b) - -b=b[::-1]#将取出的结果反转 -print(b) - -c=int(b)#将结果转换为 int 类型 -print(c) - -#分别转换成⼆二进制,⼋八进制,⼗十六进制,最后输出三种进制的结果 -print('二进制:',bin(c)) -print('八进制:',oct(c)) -print('十六进制:',hex(c)) diff --git a/exercises/190110304/1001S02E05_stats_text.py b/exercises/190110304/1001S02E05_stats_text.py deleted file mode 100644 index 2c9e805d8..000000000 --- a/exercises/190110304/1001S02E05_stats_text.py +++ /dev/null @@ -1,32 +0,0 @@ - -text=(''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those!''') -text1=text.split()#将字符串转换成列表 -text2={} #创建字典 -for i in text1: #for是发起循环的关键词;i in text1是循环规则,i是依次得到txet1列表中的各个值,然后按照索引顺序循环下去,直到最后一个 - if i in text2: - text2[i]=text2[i]+1 #统计单词出现的次数 - else: - text2[i]=1 -print(text2) - diff --git a/exercises/190110304/1001S02E05_string.py b/exercises/190110304/1001S02E05_string.py deleted file mode 100644 index e56ff1afa..000000000 --- a/exercises/190110304/1001S02E05_string.py +++ /dev/null @@ -1,50 +0,0 @@ -import re # 正则表达式 -text=('''The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those!''') - - -text2=text.replace("better","worse") #用replace将文本中 better 全部替换成 worse -print (text2) - -text3=text.split() #split将字符串转换成列表 -print (text3) - -text4 = [] - -for i in text3: #for是发起循环的关键词;i in text3是循环规则,i是依次得到txet3列表中的各个值,然后按照索引顺序循环下去,直到最后一个 - if i.find("ea") < 0: #这个if语句是判断“ea"是不是在某个单词里面 - text4.append(i) - print (text4) - -text5=text.swapcase()#用swapcase将文本中的大小写字母进行互换 -print(text5) - -text6=text3.sort() #先用split将字符串改成列表形式 然后再用sort进行排序 这里用text3是因为 text3是已经转变完成的列表 -print(text3) - - - - - - - - diff --git a/exercises/1901110099/1001S02E05_array.py b/exercises/1901110099/1001S02E05_array.py deleted file mode 100644 index 817403b7f..000000000 --- a/exercises/1901110099/1001S02E05_array.py +++ /dev/null @@ -1,16 +0,0 @@ -list=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -list.reverse() #将数组 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 翻转 -print(list) -list_str=''.join([str(x) for x in list]) #翻转后的数组拼接成字符串 -print(list_str) -list_str[3:9] #用字符串切⽚的⽅式取出第三到第八个字符(包含第三和第八个字符) -print(list_str[3:9]) -str1=list_str[3:9] -print(str1[::-1]) #将获得的字符串进行翻转 -str2=str1[::-1] -int(str2) #将结果转换为 int 类型 -print(int(str2)) -int1=int(str2) -print(bin(int1)) #转换成二进制并输出结果 -print(oct(int1)) #转换成八进制并输出结果 -print(hex(int1)) #转换成十六进制并输出结果 \ No newline at end of file diff --git a/exercises/1901110099/1001S02E05_stats_text.py b/exercises/1901110099/1001S02E05_stats_text.py deleted file mode 100644 index 72c2538d2..000000000 --- a/exercises/1901110099/1001S02E05_stats_text.py +++ /dev/null @@ -1,53 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -text1=text.replace(',','').replace('.','').replace('--','').replace('*','').replace('!','') -text2=text1.split() -dict1={} -for letter in text2: - if letter in dict1: - dict1[letter]=dict1[letter]+1 - else: - dict1[letter]=1 -print(dict1) - -print() -print('按照出现次数从大到小输出所有的单词及出现的次数') -print(sorted(dict1.items(),key = lambda x:x[1],reverse = True)) - - - - - - - - - - - - - - - diff --git a/exercises/1901110099/1001S02E05_string.py b/exercises/1901110099/1001S02E05_string.py deleted file mode 100644 index 1a953d238..000000000 --- a/exercises/1901110099/1001S02E05_string.py +++ /dev/null @@ -1,52 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters - - -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' -print('将字符串串样本 text ⾥里里的 better 全部替换成 worse') -print(text.replace('better','worse')) - -print() -print('从第 2 步的结果⾥,将单词中包含 ea 的单词剔除') -text1=text.replace('better','worse') -text2=text1.split() # string 转为 list -text3=[] -for letter in text2: - if 'ea' not in letter: - text3.append(letter) -print(text3) - - -print() -print('将第 3 步的结果⾥的字⺟进⾏⼤⼩写翻转(将⼤写字母转成⼩写,⼩写字母转成大写)') -str=' ' -text4=str.join(text3) # list 转为 string -print(text4.swapcase()) - - -print() -print('将第 4 步的结果⾥所有单词按 a…z 升序排列列,并输出结果') -text5=text4.swapcase() -text6=text5.split() # string 转为 list -text6.sort(key=lambda x:x.lower()) -print(text6) \ No newline at end of file diff --git a/exercises/1901110099/1001S02E06_stats_word.py b/exercises/1901110099/1001S02E06_stats_word.py deleted file mode 100644 index 086b53752..000000000 --- a/exercises/1901110099/1001S02E06_stats_word.py +++ /dev/null @@ -1,63 +0,0 @@ -text = ''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -''' - -def stats_text_en(text): #统计参数中每个英⽂单词出现的次数,最后返回⼀个按词频降序排列的数组 - text1=text.replace(',','').replace('.','').replace('--','').replace('*','').replace('!','') - text2=text1.split() - dict1={} - for letter in text2: - if letter in dict1: - dict1[letter]=dict1[letter]+1 - else: - dict1[letter]=1 - dict2=sorted(dict1.items(),key = lambda x:x[1],reverse = True) - return dict2 - -print("统计参数中每个英⽂单词出现的次数,最后返回⼀个按词频降序排列的数组") -print(stats_text_en(text)) - -print() - -text_cn=''' -在没风的地方找太阳,在你冷的地方做暖阳,人事纷纷,你总太天真 -''' -def stats_text_cn(text_cn): #统计参数中每个中⽂汉字出现的次数,最后返回⼀个按字频降序排列的数组 - text_cn1=text_cn.replace(',','') - - word_list=[] - for character in text_cn1: - if '\u4e00'<='\u9fa5': - word_list.append(character) - - word_dict={} - set1=set(word_list) - for character in set1: - word_dict[character]=word_list.count(character) - - word_dict1=sorted(word_dict.items(), key=lambda x: x[1], reverse=True) - return word_dict1 - -print("统计参数中每个中⽂汉字出现的次数,最后返回一个按字频降序排列的数组") -print(text_cn) -print(stats_text_cn(text_cn)) - diff --git a/exercises/1901110099/d07/mymodule/stats_word.py b/exercises/1901110099/d07/mymodule/stats_word.py deleted file mode 100644 index 55ac71c01..000000000 --- a/exercises/1901110099/d07/mymodule/stats_word.py +++ /dev/null @@ -1,70 +0,0 @@ - - -def stats_text_en(text): #统计参数中每个英⽂单词出现的次数,最后返回⼀个按词频降序排列的数组 - elements=text.split() - words=[] - symbols=',.*-!' - for element in elements: - for symbol in symbols: - element=element.replace(symbol,'') - if len(element) and element.isascii(): - words.append(element) - - counter={} - word_set=set(words) - - for word in word_set: - counter[word]=words.count(word) - - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - - -def stats_text_cn(text): #统计参数中每个中⽂汉字出现的次数,最后返回⼀个按字频降序排列的数组 - word_list=[] - for character in text: - if '\u4e00'<= character <= '\u9fff': - word_list.append(character) - - word_dict={} - set1=set(word_list) - for wording in set1: - word_dict[wording]=word_list.count(wording) - - word_dict1=sorted(word_dict.items(), key=lambda x: x[1], reverse=True) - return word_dict1 - - - -def stats_text(text): #分别调⽤stats_text_en , stats_text_cn ,输出合并词频统计结果 - return stats_text_cn(text)+stats_text_en(text) - - -if __name__ == "__main__": - text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -在没风的地方找太阳,在你冷的地方做暖阳,人事纷纷,你总太天真 -''' - - - print(stats_text(text)) \ No newline at end of file diff --git a/exercises/1901110099/d08/main.py b/exercises/1901110099/d08/main.py deleted file mode 100644 index de6e041d7..000000000 --- a/exercises/1901110099/d08/main.py +++ /dev/null @@ -1,26 +0,0 @@ -from mymodule import stats_word -import traceback -import logging - -logger = logging.getLogger(__name__) - -def text_traceback(): - try: - stats_word.stats_text(1) - except Exception as e: - print('text_traceback =>',e) - print(traceback.format_exc()) - - -def text_logger(): - try: - stats_word.stats_text(1) - except Exception as e: - print('text_logger =>',e) - logger.exception(e) - - -if __name__ == "__main__": - stats_word.stats_text(1) - text_traceback() - text_logger() \ No newline at end of file diff --git a/exercises/1901110099/d08/mymodule/stats_word.py b/exercises/1901110099/d08/mymodule/stats_word.py deleted file mode 100644 index 3c5c50ad7..000000000 --- a/exercises/1901110099/d08/mymodule/stats_word.py +++ /dev/null @@ -1,79 +0,0 @@ - - -def stats_text_en(text): #统计参数中每个英⽂单词出现的次数,最后返回⼀个按词频降序排列的数组 - - if not isinstance(text,str): #添加参数类型检查,如果输入参数不为字符串类型则抛出 ValueError 错误,并包含完整的错误提示信息 - raise ValueError('参数必须是str类型,输入类型%s' % type(text)) - - elements=text.split() - words=[] - symbols=',.*-!' - for element in elements: - for symbol in symbols: - element=element.replace(symbol,'') - if len(element) and element.isascii(): - words.append(element) - - counter={} - word_set=set(words) - - for word in word_set: - counter[word]=words.count(word) - - return sorted(counter.items(), key=lambda x: x[1], reverse=True) - - - -def stats_text_cn(text): #统计参数中每个中⽂汉字出现的次数,最后返回⼀个按字频降序排列的数组 - - if not isinstance(text,str): #添加参数类型检查,如果输入参数不为字符串类型则抛出 ValueError 错误,并包含完整的错误提示信息 - raise ValueError('参数必须是str类型,输入类型%s' % type(text)) - - word_list=[] - for character in text: - if '\u4e00'<= character <= '\u9fff': - word_list.append(character) - - word_dict={} - set1=set(word_list) - for wording in set1: - word_dict[wording]=word_list.count(wording) - - word_dict1=sorted(word_dict.items(), key=lambda x: x[1], reverse=True) - return word_dict1 - - - -def stats_text(text): #分别调⽤stats_text_en , stats_text_cn ,输出合并词频统计结果 - - if not isinstance(text,str): #添加参数类型检查,如果输入参数不为字符串类型则抛出 ValueError 错误,并包含完整的错误提示信息 - raise ValueError('参数必须是str类型,输入类型%s' % type(text)) - - return stats_text_cn(text)+stats_text_en(text) - - -if __name__ == "__main__": - text=''' -The Zen of Python, by Tim Peters -Beautiful is better than ugly. -Explicit is better than implicit. -Simple is better than complex. -Complex is better than complicated. -Flat is better than nested. -Sparse is better than dense. -Readability counts. -Special cases aren't special enough to break the rules. -Although practicality beats purity. -Errors should never pass silently. -Unless explicitly silenced. -In the face of ambxiguity, refuse the temptation to guess. -There should be one-- and preferably only one --obvious way to do -it. -Although that way may not be obvious at first unless you're Dutch. -Now is better than never. -Although never is often better than *right* now. -If the implementation is hard to explain, it's a bad idea. -If the implementation is easy to explain, it may be a good idea. -Namespaces are one honking great idea -- let's do more of those! -在没风的地方找太阳,在你冷的地方做暖阳,人事纷纷,你总太天真 -''' \ No newline at end of file diff --git a/exercises/190111088008/1001S02E01_helloworld.txt.txt b/exercises/190111088008/1001S02E01_helloworld.txt.txt deleted file mode 100644 index c026ff612..000000000 --- a/exercises/190111088008/1001S02E01_helloworld.txt.txt +++ /dev/null @@ -1 +0,0 @@ -你好,我要开始做作业了 \ No newline at end of file diff --git a/exercises/190111088008/README.md.rtf b/exercises/190111088008/README.md.rtf deleted file mode 100644 index 08778d7a8..000000000 --- a/exercises/190111088008/README.md.rtf +++ /dev/null @@ -1 +0,0 @@ -{\rtf1} \ No newline at end of file diff --git a/exercises/190111088008/~$ADME.md.rtf b/exercises/190111088008/~$ADME.md.rtf deleted file mode 100644 index 7a4315fc2..000000000 Binary files a/exercises/190111088008/~$ADME.md.rtf and /dev/null differ