如果我有这样的文本文件:
Hello World
How are you?
Bye World
我如何将它读入这样的多维数组:
[["Hello", "World"],
["How", "are", "you?"],
["Bye" "World"]]
我努力了:
textFile = open("textFile.txt")
lines = textFile.readlines()
for line in lines:
line = lines.split(" ")
但它只是返回:
["Hello World\n", "How are you?\n", "Bye World"]
如何将文件读入多维数组?