This is a real story,
and this is a good story
文本文件中有一个段落,有两行,当我打开它时
fileOpen=open(fileName,"r")
for word in fileOpen:
file=word.split()
print(file)
它印成这样:
["this", "is", "a", "real", "story"]
["and", "this", "a", "good", "story"]
我想把这个印成:
["this", "is", "a", "real", "story", "and", "this", "a", "good", "story"]
这应该适用于整段,把整段读成一行。你知道吗
只需添加行:
输出:
相关问题 更多 >
编程相关推荐