On Tue, Aug 17, 2010 at 6:21 PM, abhijeet thatte <abhijeet.tha...@gmail.com> wrote: > Hi, > I need to import few files depending on the user input. For eg if user gives > an input as "abcd" then I will have import "abcd.py". > Can not have any hard coding in the code. Does any one know how to solve the > problem.
Use the __import__ function ( http://docs.python.org/library/functions.html#__import__ ), like this: user_module = __import__("abdc") user_module.do_stuff() -- Jerry -- http://mail.python.org/mailman/listinfo/python-list