python - How do I read a file line-by-line into a list? -


How do I read each row of a file in Python and store each row as an element in a list?

I want to read the file line from the line and add each row at the end of the list.

  with open fname f: content = f.readlines () # you too At the end of each line content, you want to remove white space characters such as `\ n` = [x.strip   

I think that means you do not have an array .


Comments