-
Notifications
You must be signed in to change notification settings - Fork 1
/
字符串.py
69 lines (53 loc) · 1.33 KB
/
字符串.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var1 = 'Hello World!'
var2 = "Hello World!"
# 0123456789
var3 = 'Hello'
var4 = "World!"
print(var1)
print(var2)
print(var1[1]) # 'e'
print(var1[3]) # 'l'
print(var1[1:3]) # 'ell'
print("H" in var1) # true
print("H" not in var1) # false
print(var3)
print(var4)
print(var3 + var4)
print(var3 * 10)
# 特殊字符
print("hello's worldhello's worldhello's worldhello's worldhello's\
worldhello's worldhello's worldhello's worldhello's worldhello's\
worldhello's worldhello's worldhello's worldhello's worldhello's world")
print("hello's worldhello's worldhello's worldhello's worldhello'sworldhello's worldhello's worldhello's worldhello's worldhello'sworldhello's worldhello's worldhello's worldhello's worldhello's world")
print("\\")
print("\'")
print("'")
print("\"")
print("abcde\bf") # abcdf
print("xiaomo\n")
print("xinyi\n")
print("nuonuo")
print("xiaomo\txinyi\tnuonuo")
print("xiaomo\vxinyi\vnuonuo")
print(r"xiaomo\vxinyi\vnuonuo")
print("""hello world
I am xiaomo
please teach me english
""")
errHTML = '''
<HTML><HEAD><TITLE>
Friends CGI Demo</TITLE></HEAD>
<BODY><H3>ERROR</H3>
<B>%s</B><P>
<FORM><INPUT TYPE=button VALUE=Back
ONCLICK="window.history.back()"></FORM>
</BODY></HTML>
'''
print(errHTML)
print('''
CREATE TABLE users (
login VARCHAR(8),
uid INTEGER,
prid INTEGER)
''')
print(u'Hello\u0020World !') # Hello World !