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

  1. Python conditional derivation
  2. Python list derivation
  3. Python dictionary derivation
  4. Python variable length arguments *argc/**kargcs
  5. The Python anonymous function lambda
  6. Python Return logical judgment expressions
  7. Python is and == are different
  8. Python is mutable and immutable
  9. Shallow and deep Python copies
  10. Python Exception handling
  11. The Python thread creates and passes parameters
  12. Python thread mutex Lock
  13. Python thread time Event
  14. The Python thread Condition variable Condition
  15. Python thread Timer Timer
  16. Python thread Semaphore
  17. The Python thread Barrier object
  18. Python Thread Queue – FIFO
  19. Python thread queue LifoQueue – LIFO
  20. Python 线程优先队列 PriorityQueue
  21. ThreadPoolExecutor(1)
  22. ThreadPoolExecutor(2)
  23. The Python Process module
  24. The Python Process is different from the threading Process
  25. Queue/Pipe for communication between Python processes
  26. Python process Pool multiprocessing.pool
  27. 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!