Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python import file from same directory

# In a file system path, we would separate the components of a path 
# using / (Linux, macOS, etc.) or  (Windows). In a Python import statement, 
# however, we separate the path components using a dot (.).

import subdir.mymodule

subdir.mymodule.say_hello()
Source by csatlas.com #
 
PREVIOUS NEXT
Tagged: #python #import #file #directory
ADD COMMENT
Topic
Name
2+2 =