How to create raw strings without escaping

Raw strings

Python allows us to create raw string in which we don't need to treat the backslash as a special character. The last character in a raw string cannot be a backslash.


print 'C:\\Program Files\\fnord\\foo\\bar\\baz\\frozz\\bozz' 
print r'C:\nowhere'
print r'C:\Program Files\fnord\foo\bar\baz\frozz\bozz'
print r'Let\'s go!'




















Home »
  Python »
    Data Types »




Data Types
String
String Format
Tuple
List
Set
Dictionary