苦楝树

万物伊始...

导航

2011年11月19日 #

Python学习笔记之list各种方法

摘要: definition:A list is a data structure that holds an ordered collection of items i.e. you can store a sequence of items in a list. This is easy to imagine if you can think of a shopping list where you have a list of items to buy, except that you probably have each item on a separate line in your shop 阅读全文

posted @ 2011-11-19 01:11 苦楝树 阅读(4439) 评论(0) 推荐(0) 编辑

Python合并文件内容

摘要: 点击查看代码 1 1 # -*- coding: utf-8 -*- 2 2 import os 3 3 #print __name__ 4 4 #exit 5 5 def merged(f1,f2): 6 6 file_list = os.listdir(f1) #f1文件夹中的文件列表 7 7 file_to_write = file(f2,'w') #往f2写 8 8 for f in file_list: 9 9 file_to_read = file(f1+str(f),'r') #文件路径读取10 10 ... 阅读全文

posted @ 2011-11-19 01:01 苦楝树 阅读(360) 评论(0) 推荐(0) 编辑