So basically there is this list, with names and jobs they have:
This is a .txt document that I saved.
Jane | Teacher
Joe | Policeman
Alice | Geologist
Sher | Farmer
What I need to do is to read the document, and than print in 2D array.
So my question is how to append into 2D array?
[["Jane", "Teacher"], ["Joe", "Policeman"], ["Alice", "Geologist"], ["Alice", "Geologist"], ["Sher", "Farmer"]]
I know that when you read the text document is already stored in 1D array
["Jane Teacher", "Joe Policeman", "Alice Geologist", "Sher Farmer"]
so far I got this:
def clubList(): list_jobs = open("text.txt", "r") lines = text_file.readlines() print (li) print(len(li)) for line in li: print (line) text_file.close()
How it is stored in the array.
All it does, find the length of array.
Give me information about the array.