0

Import Multiple Modules

Is it possible to import multiple modules in one line of code like: import math, random or do you have to write: import math import random

7th Dec 2016, 2:09 AM
kawelo
kawelo - avatar
2 Respostas
+ 2
Did some testing and discovered that either listing modules after a single import or writing import for each module on its own line will have the same affect. Cool!
7th Dec 2016, 2:14 AM
kawelo
kawelo - avatar
+ 1
Yes you can import multiple modules in a single line of code separated with commas. It is always a good practice to test them in a real time python.
12th Dec 2016, 12:34 PM
Madhu Muppala
Madhu Muppala - avatar