Python
码亮虔诚
这个作者很懒,什么都没留下…
展开
-
[Python]读写文件,处理log
#Filename: using_file.pypoem = '''\Programming is funWhen the work is doneif you wanna make your work also fun: use Python!'''e = open('../poem.txt','w')e.write(poem)e.close()原创 2013-10-05 22:06:51 · 3060 阅读 · 0 评论 -
[Python]使用csv dialect 读写数据
# this is the input file of csvimport csvname = str(raw_input('please input a name : '))tele = int(raw_input('a phone No. : '))age = int(raw_input('age : '))class MYCSV(csv.excel): de原创 2013-10-05 21:28:29 · 3996 阅读 · 0 评论 -
[Python]用正则表达式进行word Count
# regular express to Count wordimport reimport sysword_re = re.compile(r'\W')#line = 'How are you?'sum = 0#f = open("test.txt")f = open(sys.argv[1])for i in f.readlines(): word_c原创 2013-10-05 21:21:59 · 1761 阅读 · 0 评论