python 代码片段9

#coding=utf-8

# 字符串指示符号 r表示raw u表示unicode

mystring=u'this is unicode!--by'
print mystring

# 'raw'表示告诉解释器不要转换字符串任何字符

file=r'c:\temp\folder\robots.txt'
print file

# 另一个实用raw的地方是正则表达式

# 可以在'''内放任何的字符串,不需要转义,比如xml
s='dongshen'
print '%s is number %d' %(s[:6],1)
hi='''hi

there
'''
print hi
posted @ 2016-01-03 22:29  yufenghou  阅读(118)  评论(0编辑  收藏  举报