python 读取文件:
list = []
f = open("data.txt","r")
for read in f.readlines():
list.append(read);
print list
运行:
[admin@dev ~]$ python queryemail.py
['1\n', '2\n', '3\n', '4\n', '5\n', '5\n', '6\n', '\n', '\n']
python 会出现\n的情况,怎么去除呢?
if colb.find("\n")>0:
colb=colb[0:len(colb)-1]
更多:http://hi.baidu.com/tag/Python/feeds