-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrings.py
48 lines (40 loc) · 1.43 KB
/
strings.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
# multi-line string
print("""How to learn English
by Slash
It seems excessive, but that doesn't mean
it didn't happen. """)
#print("this is a multi-
#line string")
print('this is a one \
line string, although I can \
write multi-line here')
# 3 types of delimiters(single, double, triple), use one of the types not appeared
# in string. For example, use double or triple if just single quotes appeared
# in string; use triple
print('What\'s your name?') # also work, just need more favor
print("What's your name?") # preferred way, double quotes design goal
print('''What's your name?''')
print("""What's your name?""")
print("What\"s your name?") # also work, just need more favor
print('What"s your name?') # preferred way, single quotes design goal
print('''What"s your name?''')
print("""What"s your name?""")
print("""What"s your n'ame?""")
print('''What"s your n'ame?''')
print('''2What\'''s your name?''')
print("""what\"""s your name?""")
print('1what\'''s your name?')
print('1what\'\'\'s your name?')
print('li''zongliang')
print("3what'''s your name?")
print("""3what'''s your name?""")
print('4what"""s your name?')
print("4what\"""s your name?")
print("4what\"\"\"s your name?")
print('''4what"""s your name?''')
print('''what''''s your na''me')
# no strong quotes in Python.
print('Hello\nworld')
print("Hello\nworld")
print('''Hello\nworld''')
print("""Hello\nworld""")