Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the difference between two Python imports

Tags:

python

import

Python has two ways to import something from a module:

from mymodule import ClassOne, ClassTwo, ClassThree

and

from mymodule import (ClassOne, ClassTwo, ClassThree)

I cannot find any note (probably, I'm just not trying hard enough) on this in Python's documentation. I want to know the significant difference between these two ways of importing.

like image 353
ikostia Avatar asked Dec 22 '22 08:12

ikostia


1 Answers

If you put the items to import between brackets, you can use more than one line for everything you want to import, without escaping newlines.

like image 58
pvoosten Avatar answered Dec 24 '22 01:12

pvoosten