What Harley said, except the last point - it's not actually necessary to change the '/'s into '\'s before calling open. Windows is quite happy to accept paths with forward slashes.
infile = open('c:/folder/subfolder/file.txt')
The only time you're likely to need the string normpathed is if you're passing to to another program via the shell (using os.system
or the subprocess
module).