摘要:
1.读文件,通过正则匹配 1 def statisticWord(): 2 line_number = 0 3 words_dict = {} 4 with open (r'D:\test\test.txt',encoding='utf-8') as a_file: 5 for line in a_file: 6 words = re.findall(r'&#\d+;|&#\d+;|&\w+;',line) 7 for word in words: 8 words_d... 阅读全文
posted @ 2013-07-24 09:55
大哉昆仑
阅读(8266)
评论(0)
推荐(0)
摘要:
1. Assertassert len(unique_characters) 10: raise AssertionError('Too many letters'2.找出不同字母>>> words = ['SEND', 'MORE', 'MONEY']>>> ''.join(words) #join 字符串连接符'SENDMOREMONEY'>>> set(''.join(words)) #set 返回不重复字符{'E& 阅读全文
posted @ 2013-07-24 09:19
大哉昆仑
阅读(317)
评论(0)
推荐(0)
浙公网安备 33010602011771号