Search Results

Search found 1 results on 1 pages for 'dunnolol'.

Page 1/1 | 1 

  • Python - open text file, but specify name when executing command

    - by Dunnolol
    I have a directory of text files that all end in the extension .txt My goal is to print the contents of the text file. I wish to be able use the wildcard *.txt to be able to specific the text file name I wish to open (I'm thinking along the lines of something like "F:\text*.txt" ?), split the lines of the text file, then print the output. Here is an example of what I want to do, but I want to be able to change "somefile" when executing my command. f = open('F:\text\somefile.txt', 'r') for line in f: print line,

    Read the article

1