python 代码片段9
生活随笔
收集整理的這篇文章主要介紹了
python 代码片段9
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
#coding=utf-8# 字符串指示符號(hào) r表示raw u表示unicodemystring=u'this is unicode!--by'
print mystring# 'raw'表示告訴解釋器不要轉(zhuǎn)換字符串任何字符file=r'c:\temp\folder\robots.txt'
print file# 另一個(gè)實(shí)用raw的地方是正則表達(dá)式# 可以在'''內(nèi)放任何的字符串,不需要轉(zhuǎn)義,比如xml
s='dongshen'
print '%s is number %d' %(s[:6],1)
hi='''hithere
'''
print hi
轉(zhuǎn)載于:https://www.cnblogs.com/yufenghou/p/5097355.html
總結(jié)
以上是生活随笔為你收集整理的python 代码片段9的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HDU 1078 FatMouse an
- 下一篇: python 字符串报错 but no