Python standard library: built-in functions all (iterable) and pythoniterable
If all the elements of an object that can be iterated are not empty (or empty iteration object), True is returned. This function is mainly used to determine whether objects such as lists, tuples, and dictionaries are empty elements. For example, a list with 10000 elements is provided. If this function is not provided, it must be implemented through loops, the computing speed will be slow. This function is equivalent to the functions of the following code:
Def all (iterable ):
For element in iterable:
If not element:
Return False
Return True
Example:
# All () function Example a = [] B = {,} c = (1, 3, '', 5) d = [1, 2, none] print ('a: ', all (a),' B: ', all (B), 'c:', all (c), 'd :', all (d ))
The output result is as follows:
A: True B: True c: False d: False
I plan to create a python standard library reference manual. Which of the following is the best choice?
I can buy a Python standard library. I recommend this one.
Python beginners start to read the python learning manual. Is there any need to create another python standard library ??
I am also self-taught. This winter vacation started, but I am reading head first python. I think it is better to read one carefully.