File tree 2 files changed +60
-0
lines changed
2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Python code to demonstrate escape character
2
+ # string
3
+
4
+ example = "Python\t is\t Programming\t Language"
5
+
6
+ print ("The string after resolving escape character is : " )
7
+ print (example )
8
+
9
+ example = "Python\n is\n Programming\n Language"
10
+ print ("The string after resolving escape character is : " )
11
+ print (example )
12
+
13
+ print ("\\ " )
14
+ print ("\' " )
15
+ print ("\" " )
16
+ print ("\u9132 " )
17
+ print ("\x25 " )
18
+ print ("\a " )
19
+ print ("python\b " )
20
+ print ("python\b c" )
21
+ print ("python\r " )
Original file line number Diff line number Diff line change
1
+ # Python code to demonstrate printing
2
+ # escape characters from repr()
3
+
4
+ # initializing target string
5
+ example = "I\n Love\t world"
6
+
7
+ print ("The string without repr() is : " )
8
+ print (example )
9
+
10
+ print ("\r " )
11
+
12
+ print ("The string after using repr() is : " )
13
+ print (repr (example ))
14
+
15
+
16
+ # Python code to demonstrate printing
17
+ # escape characters from "r" or "R"
18
+
19
+ # initializing target string
20
+ ch = "I\n Love\t World"
21
+
22
+ print ("The string without r / R is : " )
23
+ print (ch )
24
+
25
+ #print ("\r")
26
+
27
+ # using "r" to prevent resolution
28
+ ch1 = r"I\nLove\tWorld"
29
+
30
+ print ("The string after using r is : " )
31
+ print (ch1 )
32
+
33
+ #print ("\r")
34
+
35
+ # using "R" to prevent resolution
36
+ ch2 = R"I\nLove\tWorld"
37
+
38
+ print ("The string after using R is : " )
39
+ print (ch2 )
You can’t perform that action at this time.
0 commit comments