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