Escape Codes: \b, \t, \n, \a, \r : String Escape « String « Python





Escape Codes: \b, \t, \n, \a, \r

Escape Codes: \b, \t, \n, \a, \r
 
s = "e:\\Beginner"
s1 = "e:" "\\" "Beginner"
s2 = s1 + \
    "\\tst.py"

print "This is a DOS path:", s
print "This is a DOS path:", s1
print "This is a DOS path:", s2

s3 = "I contain 'single' quotes"

print s3

s6 = "I contain\t\t\tthree\t\t\ttabs"
s7 = "I contain a\t\v\tvertical tab"
s8 = "I contain a\t\a\tBELL, which you can hear"

print s6
print s7
print s8

s9 = "I contain a BACK\bSPACE"
s10 = "I contain a BACKK\bSPACE AND a \nNEWLINE and a \rLINEFEED"
s11 = "I ve got a FORM\fFEED!"

print s9
print s10
print
print s11

s12 = "If Python doesn't know what the escape code\n" \
"means, it performs the identity operation!  \identity!"
s13 = "But if you don't know what a code means, don't use it!"

print s12
print s13
           
         
  










Related examples in the same category

1.Escape characters: \n and \tEscape characters: \n and \t
2.Demonstrates the use of quotes in strings
3.String escape sequences DemoString escape sequences Demo