About 1,530,000 results
Open links in new tab
  1. importing external ".txt" file in python - Stack Overflow

    The "import" keyword is for attaching python definitions that are created external to the current python program. So in your case, where you just want to read a file with some text in it, use:

  2. How to import .txt file into python - Stack Overflow

    How to import .txt file into python Asked 8 years, 9 months ago Modified 5 years, 4 months ago Viewed 39k times

  3. How to read a text file into a list or an array with Python

    Feb 4, 2013 · I am trying to read the lines of a text file into a list or array in python. I just need to be able to individually access any item in the list or array after it is created. The text file is form...

  4. python - How can I read a text file into a string variable and strip ...

    315 In Python 3.5 or later, using pathlib you can copy text file contents into a variable and close the file in one line:

  5. python - Load data from txt with pandas - Stack Overflow

    In short, read_csv reads delimited files whereas read_fwf reads fixed width files. read_csv If your text file is similar to the following (note that each column is separated from one another by a single space …

  6. How to read a dataset from a txt file in Python? - Stack Overflow

    Jul 29, 2014 · You can use pandas. They are great for reading csv files, tab delimited files etc. Pandas will almost all the time read the data type correctly and put them in an numpy array when accessed …

  7. what is a quick way to import a text file in python?

    Apr 23, 2014 · I have a plain text file with a sequence of numbers, one on each line. I need to import those values into a list. I'm currently learning python and I'm not sure of which is a fast or even …

  8. Importing large tab-delimited .txt file into Python

    I have a tab delimited .txt file that I'm trying to import into a matrix array in Python of the same format as the text file is as shown below: 123088 266 248 244 2...

  9. How do I import other Python files? - Stack Overflow

    How do I import files in Python? I want to import: a file (e.g. file.py) a folder a file dynamically at runtime, based on user input one specific part of a file (e.g. a single function)

  10. python - Given a URL to a text file, what is the simplest way to read ...

    186 In Python, when given the URL for a text file, what is the simplest way to access the contents off the text file and print the contents of the file out locally line-by-line without saving a local copy of the text …