Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python global variable across files

# config.py
x = 0

# mod.py
import config
config.x = 1

# main.py
import config
import mod
print(config.x) # will print '1'
Source by www.edureka.co #
 
PREVIOUS NEXT
Tagged: #python #global #variable #files
ADD COMMENT
Topic
Name
4+8 =