L = ['Adam', 'Lisa', 'Bart']
t = L[0]
L[0] = L[2]
L[2] = t
print L
t = L[0]
L[0] = L[2]
L[2] = t
print L
2017-02-05
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
显示效果
"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.
Whether it's nobler in the mind to suffer.'''
显示效果
"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.
2017-02-05
t = ('a', 'b', ('A', 'B'))
print t
print t
2017-02-04
L = ['Adam', 'Lisa', 'Bart']
L[0] = 'Bart'
L[-1] = 'Adam'
print L
L[0] = 'Bart'
L[-1] = 'Adam'
print L
2017-02-04
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(3)
L.pop(2)
print L
L.pop(3)
L.pop(2)
print L
2017-02-04
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop()
L.pop()
print L
L.pop()
L.pop()
print L
2017-02-04
L = [95.5,85,59]
print L[0]
print L[1]
print L[2]
print L[2]
print L[0]
print L[1]
print L[2]
print L[2]
2017-02-04
L = ['Adam', 95.5, 'Lisa', 85, 'Bart', 59]
print L
print L
2017-02-04
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d.keys():
print "%s: %d"%(key, d[key])
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d.keys():
print "%s: %d"%(key, d[key])
2017-02-04