Last active
August 28, 2019 19:05
-
-
Save SrChach/c4ed984e2631e8e30902515c8616edfc to your computer and use it in GitHub Desktop.
Code to dynamic imports in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from importlib import import_module | |
my_module_new_name = import_module('variable.module.name') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
script_dir = os.path.dirname(__file__) # Ruta absoluta del script que estás corriendo | |
relative_path = "../algo.csv" # Pones la parte relativa de la ruta | |
abs_file_path = os.path.join(script_dir, relative_path) # Los unes | |
fp = open(abs_file_path,'r+') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment