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

Home
Python
1.2D
2.Application
3.Buildin Function
4.Class
5.Data Structure
6.Data Type
7.Database
8.Development
9.Dictionary
10.Event
11.Exception
12.File
13.Function
14.GUI Pmw
15.GUI Tk
16.Language Basics
17.List
18.Math
19.Network
20.String
21.System
22.Thread
23.Tuple
24.Utility
25.XML
Python » String » String EscapeScreenshots 
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.