[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/Lovepython015/Python/master/Article/PythonBasis/python9/2.md [Back]  [Original]

#  #

## 1import ##

Python  `import`

`import` 

```python
import module1[, module2[,... moduleN]
```

 math  `import` 

```python
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import math

_author_ = ''

print(math.pi)
```



```txt
3.141592653589793
```

 import

 import Python 

 Python Python  Python sys  path  



```python
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys

print(sys.path)
```




```txt
['C:\\Users\\Administrator\\Desktop\\Python\\Python8Code', 'G:\\PyCharm 2017.1.4\\helpers\\pycharm', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\python36.zip', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\DLLs', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages', 'C:\\Users\\Administrator\\Desktop\\Python\\Python8Code\\com\\Learn\\module\\sys']

```

## 2fromimport  ##




Python  `import`  `fromimport` 



```python
from modname import name1[, name2[, ... nameN]]
```

 `fromimport`   `import` 



 `import`  sys  version 

![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-14-from%C2%B7%C2%B7%C2%B7import%E5%92%8C%20import%E7%9A%84%E5%8C%BA%E5%88%AB1.png)

`fromimport`  version 

![fromimport import2](media/from%C2%B7%C2%B7%C2%B7import%E5%92%8C%20import%E7%9A%84%E5%8C%BA%E5%88%AB2-2.png)


## 3from  import *  ##

 `from sys import version`  version 



 sys  `executable`  `from sys import executable` ,



 `from  import *` 

```python
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

from sys import *

print(version)
print(executable)

```



```txt
3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]
C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe
```





Web Proxy Viewer  |  New URL  |  Original Page