1
Good night. I have a text file where I have already converted your content to lists. Each line in the file has become a list[], but now I need these lists to be all within an array. This way I can’t concatenate because there is only one variable holding all the lists: Ex:
File contains:
1 'ola' 'ali' 393
2 'ola2' 'ali2' 394
3 'ola3' 'ali3' 395
Then converted to lists, list = file.split()
Return:
[1, 'ola', 'ali', 393]
[2, 'ola2', 'ali2', 394]
[3, 'ola3', 'ali3', 395]
So far so good, but now I need to play all the lists that are within the variable for an array, so I can scroll through lines and indexes and change as necessary. Would have to stay:
matrix [[1, 'ola', 'ali', 393],[2, 'ola2', 'ali2', 394],[3, 'ola3', 'ali3', 395]]
I ended up doing it in a way that ended up getting each row an array, did not leave as expected. The research I’ve done always ends up putting together separate lists and separate variables. I imagine I need to do a line break or something, but I’ve already lost myself, I keep bumping into the same examples.
Edit:
Look at the return of this code.
Edit 18/10
I was able to create lists inside the matrix, but it’s column lists and I can’t invert. How can I exchange each column for an index, I take column 0 of all indexes and create a new list, then column 1 and new list, so I can get the chosen index with the content I want. It would be an ordination, but I can’t seem to do it. Image of the code so far:
Could you post your code showing what you’ve tried? So it’s better for the community to help you.
– gato
Look I honestly did not understand what you did, here is not returning any break, prints the total value of each position, maybe it was the
n
that was misplaced, try the code again, this time simply try to replace the file name.– Edilson