1. 如何同時在字符串中顯示單引號和雙引號
print('hello "world"')
print("hello 'world'")
# 轉義符
print('"hello" \'world\'')
hello "world"
hello 'world'
"hello" 'world'
2. 讓字符串中的轉義符失效有幾種方法(r、repr和\)
print(r'Let \'s go!')
Let \'s go!
print('hello \nworld')
print(repr('hello \nworld'))
hello
world
'hello \nworld'
print('hello \\nworld')
hello \nworld
3. 如何保留字符串的原始格式
print('''
hello
world
''')
hello
world