-
Notifications
You must be signed in to change notification settings - Fork 0
python_study{py}:
Star_IMPL edited this page Jun 1, 2018
·
5 revisions
python2.7 编码
#-- coding: xxx --
#-- coding:UTF-8 --# -- coding:iso-8859-15 -- a=u"€" print ord(a)
路径的写法 print 'C:\a\b' 结果C:
print r'C:\a\b' 结果c:\a\b
print """aaa bbb""" 结果: aaa bbb
'aaa'+'bbb' 结果:'aaabbb'
'aa''bb' 结果'aabb'
num ='abcde' num[2] 结果'c' num[-1] 结果'e'
切片时的索引是在两个字符 之间 。左边第一个字符的索引为 0,而长度为 n 的字符串其最后一个字符的右界索引为 n。例如:
+---+---+---+---+---+---+ | P | y | t | h | o | n | +---+---+---+---+---+---+ 0 1 2 3 4 5 6 -6 -5 -4 -3 -2 -1