a=10
b=0
b+=a
c=-100
c-=a
print (a, b ,c)
print (dir(a))
print (abs(a)+abs(c))
print type(a)
a = 3.0
b = 2.5
c = 2.4
print (round(a))
print (round(b))
print (round(c))
print ('##' * 20)
c = 2.555
d = 1.545
print (round(c,2))
print (round(d,2))
print (not True)
a = 10
b = 20
c = 100
print (not (a>b and c>a))
a = 'abcdef'
b = 'bbbbb'
c = 'ccccc'
print (dir(a))
print (a,b,c)
print (type(a))
print (a[0], a[1], a[2])
print (a.find('d'))
print (a.replace('a','h'))
b = 'asdaaaadfgaaadfghjaaa'
print (b.split('aaa'))
print ('333'.join(a))
print ('333'.join(b.split('aaa')))
把字符串取出来后左右空格去掉
s = ' ll jj ddd '
print s
print (s.strip())
print (s.lstrip())
print (s.rstrip())
name = 'adfgfdfdg'
print ('hello' +name)
f = '{0},{1},{0}'.format('aa',name)
print f
g = ('my name is %s') % 'alex'
print g
print ('{name}:{age}'.format(name='alex',age=27))
a = ['a','b','c',1,'abc']
print a
print type(a)
print dir(a)
a.append('hell0')
print a
print a.index('abc')
a.insert(3,'abcxb')
print a
a.pop()
print a
a.remove(1)
print a
a.sort()
print a
a.reverse()
print a
print (a[0:4])
print (a[1:3:2])
t = 'aswrtgbvfg'
print t
print (tuple(t))
a = ('a','b','c',123,'a','a')
print a
print type(a)
m = ('a',)
print type(m)
print (dir(a))
print a.count('a')
print a.index('b')
k= {'name':'alex','age':'20'}
print k
print type(k)
k1 = dict(a = 1,b=2,c=3)
d=dict([('name','alex'),('age',27)])
print d
print k1
print dir(k1)
print k1.clear()
print k.get('name')
print (k.setdefault('address','shanghai'))
print (k.keys())
print (k.iterkeys())
print (k.values())
print(k.iteritems())
for x,y in k.iteritems():
print (x,y)
print (k.items())
print k
print '#'*20
print (k.pop('address'))
print k
v= ['a','b','c','d']
m = {}
n = m.fromkeys(v,123)
b = dict.fromkeys(v,123)
print n
a1 = ['a','b','c','d']
a2 = [1,2,3,4]
a3 = zip(a1,a2)
print a3
print k
print k1
k1.update(k)
print k1
k2 = dict(a=1,b=10,c=7,d=2)
print k2
print sorted(k2.items())
a = 1
help(sorted)
dir(a)
#int str dict list tuple
age = 20
print('My age is:' +str(age))