内置函数

2018-07-05  本文已影响0人  Levi__s

abs() 函数

输出结果为:1 和 100.1

Python dict() 函数

Python help() 函数

help('str')

Python min() 函数

print('min(1,5,33,3,1,56,67,2)',min(1,5,33,3,1,56,67,2))

输出结果为:min(1,5,33,3,1,56,67,2)========>1

Python setattr() 函数

输出结果为1 和 5

Python all() 函数

输出的结果为:True,False,False

Python dir() 函数

a=dir([object])

print(a)

输出结果为:

['__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']

Python hex() 函数

a=hex(255)

print(a)

输出结果为:    0xff

Python next() 函数

输出结果为:1,2,3,4,5

Python slice() 函数

输出的结果为:    [0, 1, 2, 3, 4]

Python any() 函数

a =any(['a','b','c','d'])

print(a)

######################

b =any([1,2,3,4,5,0])

print(b)

######################

c =any([0,False,0])

print(c)

输出结果为:True,True,False

Python divmod() 函数

输出的结果为:(3, 1),(4, 0)

上一篇 下一篇

猜你喜欢

热点阅读