Ich bekomme eine Fehlermeldung (# import package from short; SyntaxError: invalid syntax), wenn ich Pakete mit einem Loop einlesen will:
Code: Alles auswählen
pkgs = {
"package": ["pandas", "numpy"],
"short": ["pd", "np"]
}
for i in range(1, len(pkgs)):
package = pkgs.get("package")
short = pkgs.get("short")
import package[i] from short[i]
Vielen Dank schon im Voraus.
LeaRn
PS: Dass dieser Loop im Allgemeinen keine gute Idee ist, bin ich mir bewusst.