Feb 7, 2012

Escaping Charecters in python

Just an example commonly used
Escaping the "\" with another "\"

>>> with open('C:\\Folder1\\Folder2\\file') as file_handler:
Or just add an "r" before the path (this stands for "raw").

>>> with open(r'C:\Folder1\Folder2\file') as file_handler:

No comments: