Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

import all files on the same directory python

import os
for module in os.listdir(os.path.dirname(__file__)):
    if module == '__init__.py' or module[-3:] != '.py':
        continue
    __import__(module[:-3], locals(), globals())
del module
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #import #files #directory #python
ADD COMMENT
Topic
Name
7+8 =