directory
- Python globals function syntax
- Python globals function
- Three. Guess you like it
Python Basics: Python Basics
The Python built-in function locals returns all local variables directly from the current location as a dictionary. Globals is a Python built-in function provided by locals. This function directly returns all global variables at the current position as a dict dict;
Python globals function syntax
Return value: return a dictionary containing all global variables at the current position; globals()Copy the code
Python globals function
#! Usr /bin/env python # -* -coding :utf-8 _*- """ @author: Py @time :2021/05/18 07:37@motto: Motto: no short step to achieve a thousand miles, no small flow cannot become a river sea, program life is wonderful need to keep on accumulating! """ x = 1 def func(): c = 1 d = 2 return False if __name__ == "__main__": A = 1, b = 2 func () print (globals () "' output: {' __name__ ':' __main__ ', '__doc__ : None,' __package__ ': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x00000199AFAFD0F0>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': 'E:/Project/python/python_project/untitled10/123.py', '__cached__': None, 'x': 1, 'func': <function func at 0x00000199ADEE2EA0>, 'a': 1, 'b': 2} '''Copy the code
3.Guess you like
- Python conditional derivation
- Python list derivation
- Python dictionary derivation
- Python variable length arguments *argc/**kargcs
- The Python anonymous function lambda
- Python Return logical judgment expressions
- Python is and == are different
- Python is mutable and immutable
- Shallow and deep Python copies
- Python Exception handling
- The Python thread creates and passes parameters
- Python thread mutex Lock
- Python thread time Event
- The Python thread Condition variable Condition
- Python thread Timer Timer
- Python thread Semaphore
- The Python thread Barrier object
- Python Thread Queue – FIFO
- Python thread queue LifoQueue – LIFO
- Python 线程优先队列 PriorityQueue
- ThreadPoolExecutor(1)
- ThreadPoolExecutor(2)
- The Python Process module
- The Python Process is different from the threading Process
- Queue/Pipe for communication between Python processes
- Python process Pool multiprocessing.pool
- Python GIL lock
The Python globals function is used to describe the globals function
This article is posted by the blog – Ape says Programming Ape says Programming!