Just a quick one- I'm writing code that asks the user for a filename and checks that it exists. If it does it has to print the file's contents, if not print a message.
import os fileName = raw_input("Enter the name of the file: ") if os.path.exists(fileName) == True: fileName.read() else: print "error, that file does not exist"
As fileName is now a string, how do I read the contents of the user's input?
Edited 6 Years Ago by jozz3: n/a