L = ['Adam', 'Lisa', 'Bart', 'Paul']
for index, name in enumerate(L):
print index+1, '-', name
for index, name in enumerate(L):
print index+1, '-', name
def firstCharUpper(s):
return s[0].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s[0].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2018-05-08
非orderdict,返回无序
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for (key, value) in d.items():
print("%s: %s" % (key, value))
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for (key, value) in d.items():
print("%s: %s" % (key, value))
2018-05-08