On Dec 12, 2012 9:47 AM, "Yong Hu" <yhu221...@gmail.com> wrote: > > I have a few scripts whose file names start with numbers. For example, 01_step1.py, 02_step2.py > > I tried to import them in another script by "import 01_step1" or "from 01_step1 import *". Both failed, saying "SyntaxError: invalid syntax" > > Is there anyway to import those files? The file name must start with characters? > --
I believe the restriction is that the module names must be valid identifiers. You may still be able to import them using __import__ and then assign the resulting module object to a valid name. > http://mail.python.org/mailman/listinfo/python-list
-- http://mail.python.org/mailman/listinfo/python-list