Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #ReadFile.py
- #Python 2.7
- #Read & display contents of text file
- #Chris Clarke
- #13.08.2014
- filename = raw_input("Enter name of text file to open: ")
- try:
- with open(filename) as f:
- for line in f:
- print line,
- except IOError:
- print "Error opening file:", filename
- else:
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement