我很惊讶,这么简单的事情一直困扰着我。下面是代码
list = []
f = open("log.txt", "rb") # log.txt file has line separated values,
for i in f.readlines():
for value in i.split(" "):
list.append(value)
print list
输出是
['xx00', '\n', 'xx01in', '\n', 'xx01na', '\n', 'xx01oz', '\n', 'xx01uk', '\n']
我怎样才能摆脱新行,即'\ n'?