How to do multiple imports in Python?

For known module, just separate them by commas:

import lib1, lib2, lib3, lib4, lib5

If you really need to programmatically import based on dynamic variables, a literal translation of your ruby would be:

modnames = "lib1 lib2 lib3 lib4 lib5".split()
for lib in modnames:
    globals()[lib] = __import__(lib)

Though there’s no need for this in your example.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)