微信之初学者:字符串

时间:2016-11-19 23:42:07   收藏:0   阅读:266

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:\nasd\asd\q\asd‘)
print(r‘C:\as\asd\asd\asd‘‘\\‘)#结尾以反斜线

 

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!