| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/We2one/Notes/master/python-basic-notes/python-days/Day_09.md | [Back] [Original] |
# Day_09
##
+ **** : ()
+ :
+
+
+
+
+ :
+ :
+ :
+ -->
+ -->
+ ****
+ :
```
def (fn):
def wrapper(*args, **kwargs):
res = fn(*args, **kwargs)
return res
return wrapper
```
+ :
+
+
```python
def wrap(fn):
def inner(name, age):
print(f"{age}")
age -= 2
fn(name, age)
return inner
@wrap
def func(name, age):
print(f"name: {name}, age: {age}")
func("", 21)
```
+
+
+
##
+
+
+
+
+
+ :
+
+ : `import `
+
1. sys.path
2. PythonPATH []
3.
+ []
+ : `import `
+
+ : `import as `
+ []
+ : `from import /`
+ ()
+
+ **. :** :
+ **.. :** :
+
+ []
+ : `from . import `
+ : `from . import as `
+ [] : `from . import /`
##
+ (Package) : Python
+ : \_\_init__.py (,)
+
+ []
+ : `from import `
+ []
+ : `from import as `
+ [] \_\_init__.py
+ : `from . import `
+
+ : `from import *`
+
+
+ `from . import `
+ |
+ `from . import `
+ \_\_name\_\_ () :
`if __name__ == "main": `
##
+ **random ** ()
+
+ `random()` : 0-1
+ `uniform(a, b)` :
+
+ `randint(a, b)` :
+ `randrange(start, stop, [step])` : start, stop (step)
+
+ `random.choice(lst)` :
```python
# from random import choice
import random
lst = [1,2,3,4,5]
random.choice(lst)
# choice(lst)
```
+
+ `random.shuffle()` :
| Web Proxy Viewer | New URL | Original Page |