If I have a text file like this:
Hello World How are you? Bye World
How would I read it into a multidimensional array like this:
Adding to the accepted answer:
with open("textFile.txt") as textFile: lines = [line.strip().split() for line in textFile]
This will remove '\n' if it is appended to the end of each line.