這個 ‘\’符號的作用是連接變量或者代碼過長,仔細看下面代碼,理解它的用法:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb
a = "https://blog.51cto.com"\
"dinghanhua/p/"\
"9900775.html"
print a
b= """第一行
第二行
第三行"""
print b
c = "thins line is toooooooooooo\
lone"
print "c: ",c
d = "https://blog.51cto.com/\
dinghanhua/p/\
9900775.html"
print "d: ",d
print "thins line is toooooooooooo\
lone"
上面的輸出結果
https://blog.51cto.com/dinghanhua/p/9900775.html
第一行
第二行
第三行
c: thins line is toooooooooooolone
d: https://blog.51cto.com/dinghanhua/p/9900775.html
thins line is toooooooooooolone