About 50 results
Open links in new tab
  1. python - How to read a file line-by-line into a list? - Stack Overflow

    How do I read every line of a file in Python and store each line as an element in a list? I want to read the file line by line and append each line to the end of the list.

  2. How should I read a file line-by-line in Python? - Stack Overflow

    Jul 19, 2012 · The title says that this question is about reading line-by-line and not reading binary files (which is very different). If you want to edit the last example to use the print-function rather than the …

  3. python - How can I read large text files line by line, without loading ...

    Jun 25, 2011 · I want to read a large file (>5GB), line by line, without loading its entire contents into memory. I cannot use readlines() since it creates a very large list in memory.

  4. python - How to read specific lines from a file (by line number ...

    I'm using a for loop to read a file, but I only want to read specific lines, say line #26 and #30. Is there any built-in feature to achieve this?

  5. Iterating over lines in a file python - Stack Overflow

    Jul 28, 2015 · In the first one you are iterating over the file, line by line. In this scenario, the entire file data is not read into the memory at once; instead, only the current line is read into memory.

  6. python - Read file from line 2 or skip header row - Stack Overflow

    Jan 25, 2011 · How can I skip the header row and start reading a file from line2?

  7. How to use regexp on file, line by line, in Python - Stack Overflow

    Apr 25, 2020 · Here is my regexp: f\(\s*([^,]+)\s*,\s*([^,]+)\s*\) I'd have to apply this on a file, line by line. The line by line is OK, simple reading from file, and a loop. But how do I apply the regexp to the …

  8. Python read CSV file line by line in loop - Stack Overflow

    Oct 25, 2020 · c = 0 = read line 0 c = 1 = read line 1 c = 2 = read line 2 and so on and so on... islice, pandas, and so on, didn't work it out for me so far. I need this construction exact as it is for another …

  9. python - How to read a file in reverse order? - Stack Overflow

    How to read a file in reverse order using python? I want to read a file from last line to first line.

  10. python - Loading and parsing a JSON file with multiple JSON objects ...

    ValueError: Extra data: line 2 column 1 - line 225116 column 1 (char 232 - 160128774) I looked at 18.2. json — JSON encoder and decoder in the Python documentation, but it's pretty discouraging to read …