0

In Python, of course you can say:

from file import variable

But is it possible to import a file at runtime when it is assigned in __main__ ? For example, you pass a variable in a command line called the file you want to your program, call it daily

Can you now say,

from daily import dailyList

So daily is a string, and it is not known until the command line is parsed?

interjay
  • 107,303
  • 21
  • 270
  • 254
Ivan
  • 7,448
  • 14
  • 69
  • 134

0 Answers0