标签:rem ase _for 包含 不包含 取绝对值 getattr ini asc
1 #!/usr/bin/env python 2 # _*_ coding: UTF-8 _*_ 3 # Author:taoke 4 i = 100 5 print(abs(i)) 6 i = -100 7 print(abs(i))
1 print(dict({"a":1, "b":2, "c":3}))
1 print(min([1,2,34,5,6,7,0,100,-2]))
运行结果:-2
setattr(x, ‘foobar‘, 123)
等同于x.foobar = 123
1 print(all([1,23,45,3,-1])) 2 print(all([1,23,45,3,0,-1]))
运行结果:
True
False
1 print(bin(1)) 2 print(bin(2)) 3 print(bin(3)) 4 print(bin(4)) 5 print(bin(5)) 6 print(bin(255))
运行结果:
0b1
0b10
0b11
0b100
0b101
0b11111111
1 print(dir([1,2,3,4,5]))
运行结果:
[‘__add__‘, ‘__class__‘, ‘__contains__‘, ‘__delattr__‘, ‘__delitem__‘, ‘__dir__‘, ‘__doc__‘, ‘__eq__‘, ‘__format__‘, ‘__ge__‘, ‘__getattribute__‘, ‘__getitem__‘, ‘__gt__‘, ‘__hash__‘, ‘__iadd__‘, ‘__imul__‘, ‘__init__‘, ‘__init_subclass__‘, ‘__iter__‘, ‘__le__‘, ‘__len__‘, ‘__lt__‘, ‘__mul__‘, ‘__ne__‘, ‘__new__‘, ‘__reduce__‘, ‘__reduce_ex__‘, ‘__repr__‘, ‘__reversed__‘, ‘__rmul__‘, ‘__setattr__‘, ‘__setitem__‘, ‘__sizeof__‘, ‘__str__‘, ‘__subclasshook__‘, ‘append‘, ‘clear‘, ‘copy‘, ‘count‘, ‘extend‘, ‘index‘, ‘insert‘, ‘pop‘, ‘remove‘, ‘reverse‘, ‘sort‘]
标签:rem ase _for 包含 不包含 取绝对值 getattr ini asc
原文地址:http://www.cnblogs.com/taoke2016/p/7502558.html