How do you import a file in python with spaces in the name? -
do have to take out spaces in file name import it, or there way of telling import
there spaces?
you should take spaces out of filename. because filename used identifier imported modules (i.e. foo.py
imported foo
) , python identifiers can't have spaces, isn't supported import
statement.
if really need reason, can use __import__
function:
foo_bar = __import__("foo bar")
this import foo bar.py
foo_bar
. behaves little bit different import
statement , should avoid it.
Comments
Post a Comment