该文件的内容如下所示:
1/15/13,930,1441.5
1/15/13,1000,1442.75
1/15/13,1030,1444
我跑:
the_txt_file = open('/txt_file')
然后我运行:
the_txt_file_as_a_list = the_txt_file.readlines()
然后我运行:
print the_txt_file_as_a_list
我明白了:
['1/15/13,930,1441.5\r1/15/13,1000,1442.75\r1/15/13,1030,1444\r1/']
但我期待的是这样的:
['1/15/13,930,1441.5\n','15/13,1000,1442.75\n','15/13,1030,1444\n']
这种情况经常发生在我身上,这是怎么回事?