s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in L:
if i in s:
s.remove(i)
else:
s.add(i)
print s
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in L:
if i in s:
s.remove(i)
else:
s.add(i)
print s
2015-06-04
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d['Adam']
print 'Lisa:',d['Lisa']
print 'Bart:',d['Bart']
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d['Adam']
print 'Lisa:',d['Lisa']
print 'Bart:',d['Bart']
2015-06-04
s = set()
l = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in l:
i = i.lower()
s.add(i)
print 'adam' in s
print 'bart' in s
l = ['Adam', 'Lisa', 'Bart', 'Paul']
for i in l:
i = i.lower()
s.add(i)
print 'adam' in s
print 'bart' in s
2015-06-04
d = {
95: 'Adam',
85: 'Lisa',
59: 'Bart'
}
print 95, ':', d[95]
95: 'Adam',
85: 'Lisa',
59: 'Bart'
}
print 95, ':', d[95]
2015-06-04
这个例子在Python2.7.9IDLE shell中4个print分4次输出,出来的结果保存为一个html文件,打开html文件才能到表格.麻烦!!
2015-06-03