1, using the module reason
To save memory
2, what is the module
- Python code or C language code
- Sort by function
3. Module classification
- Built-in modules, modules included in the Python interpreter
- Expansion module, installation required
Import Time forIinchRange (0,101,2): Time.sleep (0.1) Char_num= I//2#print How many ' * 'Per_str ='\r%s%%:%s\n'% (I,'*'* Char_num)ifi = = 100Else '\r%s%%:%s'% (I,'*'*char_num)Print(per_str,end="', flush=true)
Print progress bar
4. Built-in module
Import= collections.namedtuple ('tuples', ['a' ,'b','C'= t ( Wang', a)print(mytup)
View Code
Results:
Tuples (a=24, b= ' Wang ', c=80)
Specify a key first, which is equivalent to defining a class;
Specifying value again is the equivalent of instantiating this class;
- Deque is a two-way list for efficient insert and delete operations, suitable for use in queues and stacks
fromCollectionsImportDequeq= Deque (['a','b','C']) Q.append ('x') Q.appendleft ('y') Qdeque (['y','a','b','C','x'])View Code
Python module-Day8