Describe the grammar other than the basic control structure and data structure as Python 3 for yourself. Emphasis on practicality over accuracy. (This is a page for me who mainly uses Java and .NET to use Python)
The control structure is Now Python3 (Control Structure) The data structure is Now Python3 (Data Structure)
(1)import module name as alias
(2)from module name import definition name as alias,Definition name as alias
* Definition names include class names, function names, variable names, etc.
import example
import math as m
from math import pi
print( m.pi )
print( pi )
In (1), import the module and use it with module name.definition name. (2) imports the defined name in the module and uses it as the defined name. (It is convenient when importing a class because it can be accessed only by the definition name without writing the module name) When importing a module in a package that organizes modules in a hierarchical structure, you can specify the module name as package name.subpackage name.module name.
Recommended Posts