About 50 results
Open links in new tab
  1. 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 …

  2. python - What's the type of read () function's return value? - Stack ...

    Apr 16, 2013 · if buf[0]=="\x47": IndexError: string index out of range My questions are: What's the type of a return value in read() function? How can I get the first character in a string or array?

  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 file.read() function output? - Stack Overflow

    Aug 6, 2012 · I am trying to output a file's contents to terminal using the File.read () function in Python, but keep receiving the following output which doesn't match my ".txt" file contents.

  5. What is the code of read() function in python? - Stack Overflow

    Sep 28, 2018 · As others already mentionned, there's no read() function in Python - what you're looking for (as confirmed in a comment) is the read() method of the file object (Python 2.x) or …

  6. python - Read File Function - Stack Overflow

    May 22, 2017 · Essentially, I wan this function to take a file name, read the contents of that file into the profile_list. I want the list of profile objects to be returned when the function is called, but I can'...

  7. python - When should I ever use file.read () or file.readlines ...

    Jun 29, 2016 · Please clarify. is the timeit measurement for read, or for readlines? I'd expect the read loop to take longer because it returns a single string, so iterating over it would go character-by …

  8. python - How can I use a global variable in a function? - Stack Overflow

    Jul 11, 2016 · In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a new value anywhere within the function’s body, it’s assumed to be a local.

  9. python - Reading binary file and looping over each byte - Stack Overflow

    In Python, how do I read in a binary file and loop over each byte of that file?

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

    How do I read from standard input (stdin)? There's a few ways to do it. sys.stdin is a file-like object on which you can call functions read or readlines if you want to read everything or you want to read …