About 50 results
Open links in new tab
  1. Easiest way to read/write a file's content in Python

    In Ruby you can read from a file using s = File.read (filename). The shortest and clearest I know in Python is with open (filename) as f: s = f.read () Is there any other way to do it that makes it

  2. python - Reading JSON from a file - Stack Overflow

    If you are reading the data from the Internet instead, the same techniques can generally be used with the response you get from your HTTP API (it will be a file-like object); however, it is heavily …

  3. Reading a file using a relative path in a Python project

    Reading a file using a relative path in a Python project Asked 9 years, 3 months ago Modified 2 years, 3 months ago Viewed 284k times

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

  5. Why does my Python code print the extra characters "" when …

    Dec 21, 2015 · Why does my Python code print the extra characters "" when reading from a text file? Asked 10 years, 2 months ago Modified 2 years, 7 months ago Viewed 68k times

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

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

  8. Unicode (UTF-8) reading and writing to files in Python

    This particular reading allows one to take UTF-8 representations from within Python, copy them into an ASCII file, and have them be read in to Unicode. Under the "string-escape" decode, the slashes …

  9. Reading specific columns from a text file in python

    Jun 20, 2001 · I have a text file which contains a table comprised of numbers e.g: 5 10 6 6 20 1 7 30 4 8 40 3 9 23 1 4 13 6 if for example I want the numbers contained only in the second column, how do i …

  10. Character reading from file in Python - Stack Overflow

    Character reading from file in Python Asked 17 years, 4 months ago Modified 5 years, 1 month ago Viewed 326k times