Electron microscopy
 
"While True"and "While 1" in Python
- Integrated Circuits -
- An Online Book -
Integrated Circuits                                                                                   http://www.globalsino.com/ICs/        


=================================================================================

While True and While 1 Is infinite loops in perl and Python. In most cases, python acts as though True equals 1. In Python 2.x, True is not a keyword, but just a built-in global constant that is defined to 1 in the bool type. In Python 3.x it truly becomes a keyword and a real constant. With the "while True" loop, e,g. it constantly refreshes and constantly prints out the mouse position. 

===============================================

A while loop that continuously prompts the user to input their name. If the input matches the string "Yougui", the loop will break. Otherwise, it will continue prompting for input. Here's a breakdown: (code):  

 

Output: 

 

============================================  

A while loop that continuously prompts the user to input their name. If the entered name is not equal to "Yougui", it uses the continue statement to skip the rest of the loop's code and goes back to the beginning of the loop to prompt for input again. If the entered name is "Yougui", it breaks out of the loop (break), ending the program. (code):  

 

Output: 

 

============================================

Keyboard interruption to stop an action: code:          
          Keyboard interruption to stop an action

===============================================

Constantly refreshes and constantly prints out the mouse position (different from without "while True" ): code:
          Build databases with a different/uncertain number of members at different ranks
Output:          
          Build databases with a different/uncertain number of members at different ranks

===============================================

Build databases with a different/uncertain number of members at different ranks: code:
          Build databases with a different/uncertain number of members at different ranks
Inputs and output:          
          Build databases with a different/uncertain number of members at different ranks

===============================================

Copy text into clipboard and then you can paste it a webpage automatically: code:
         Copy text into clipboard and then you can paste it anywhere
Output:         
         Copy text into clipboard and then you can paste it anywhere
         Copy text into clipboard and then you can paste it anywhere

===============================================

Print a copied list together: code:
         Copy text into clipboard and then you can paste it anywhere
Output:         
         Copy text into clipboard and then you can paste it anywhere===============================================

True and 1 : code:
         Copy text into clipboard and then you can paste it anywhere
Output:         
         Copy text into clipboard and then you can paste it anywhere

===============================================

Open a new Notepad window and bring it to the most front: code:          
          Search a window


 


 

 

=================================================================================