当前位置:首页 > 微信 > 正文

微信之初学者:字符串

1.单引号和双引号

print(‘hello world‘)
print("hello world")

2转义引号

print("let‘s go!")
print(‘let‘s go!‘)
print(‘let‘s say "hello world"‘)

3字符串拼接

print(‘hello,‘ + ‘world‘)#注意hello后面的逗号,

4长字符串的输入

print(‘‘‘Where there  is a will,here is a way,
you jump ,I jump.
to be or not to be,is a question.
let‘s go‘‘‘)#在这种模式里,不要在需要反斜线来转义

5原始字符串

print(‘C:\nasd\asd\q\asd‘)
print(r‘C:nasdasdqasd‘)
print(r‘C:asasdasdasd‘‘\‘)#结尾以反斜线

 

微信之初学者:字符串