for x in range(1, 9):
for y in range(x+1, 10):
print x*10 + y
for y in range(x+1, 10):
print x*10 + y
2019-05-10
s = set(['adam','bart'])
print 'adam' in s
print 'bart' in s
print 'adam' in s
print 'bart' in s
2019-05-09
# -*- coding: utf-8 -*-
d = {
95:'Adam' ,
85:'Lisa',
59:'Bart'
}
print '95:\''+d.get(95)+'\''
d = {
95:'Adam' ,
85:'Lisa',
59:'Bart'
}
print '95:\''+d.get(95)+'\''
2019-05-09
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop(2)
print L
这样也行,哈哈
L.pop(2)
L.pop(2)
print L
这样也行,哈哈
2019-05-08
print([x * 100 + y * 10 + z for x in range(1, 10) for y in range(0, 10) for z in range(0, 10) if x == z])
2019-05-08
def firstCharUpper(s):
b=list(s)
b[0] = s[0].upper()
b[1:6]=s[1:]
s=''.join(b)
return s
b=list(s)
b[0] = s[0].upper()
b[1:6]=s[1:]
s=''.join(b)
return s
2019-05-05
在Python中,字符串是不可变类型,即无法直接修改字符串的某一位字符。但可以通过一些方式间接修改,比如replace函数:
def firstCharUpper(s):
s=s.replace(s[0],s[0].upper())
return s
def firstCharUpper(s):
s=s.replace(s[0],s[0].upper())
return s
2019-05-05