Quick Note on Windows File Names

See p. 32 in the Guzdial Text.

For most of our programs, we've been using the function pickAFile() to get a file name. This function asks the end-user to select a file from a dialog.

fileName = pickAFile()
picture = makePicture(fileName)

Sometimes you (the programmer) want your image to be a certain file, not want chosen by the end-user. To do this, you can just say:

picture = makePicture("someFile")

where 'someFile' is the full path of a file on the computer, e.g.,

H:\python\wolber.jpg

But if you're using the Windows operating system, you must do something wacky to get such a file reference to work. You must put an 'r' before the file name, e.g.,

picture = makePicture(r"H:\python\wolber.jpg")

This is because, without the 'r', Python thinks the backslashes are special characters with special meanings (e.g., \n means end of line)

Instructor example.