About 51 results
Open links in new tab
  1. How should I read a file line-by-line in Python? - Stack Overflow

    Jul 19, 2012 · How should I read a file line-by-line in Python? Asked 13 years, 8 months ago Modified 1 year, 2 months ago Viewed 406k times

  2. Difference in read (), readline () and readlines () in Python

    Sep 24, 2019 · In the commands read(), readline() and readlines(), one difference is of course reading whole file, or a single line, or specified line. But I didn't understand the use/necessity of bracket () in …

  3. 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.

  4. Python: How to properly use readline () and readlines ()

    Dec 25, 2018 · 2 If you are using readline() function, you have to remember that this function only returns a line, so you have to use a loop to go through all of the lines in the text files. In case of using …

  5. A non-blocking read on a subprocess.PIPE in Python

    92 I have often had a similar problem; Python programs I write frequently need to have the ability to execute some primary functionality while simultaneously accepting user input from the command line …

  6. 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?

  7. python - Undo a file readline () operation so file-pointer is back in ...

    I'm browsing through a Python file pointer of a text file in read-only mode using file.readline() looking for a special line. Once I find that line I want to pass the file pointer to a method that...

  8. python - How do I read from stdin? - Stack Overflow

    In Python 2, this is raw_input(prompt). open(0).read() - In Python 3, the builtin function open accepts file descriptors (integers representing operating system IO resources), and 0 is the descriptor of stdin. It …

  9. 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?

  10. python - python3 file.readline EOF? - Stack Overflow

    This makes the return value unambiguous; if f.readline() returns an empty string, the end of the file has been reached, while a blank line is represented by '\n', a string containing only a single newline. and …