python
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python [2020/01/03 15:08] – admin | python [2021/05/06 11:15] (current) – admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ### Create a list of objects from a class | + | ## Data Type |
| + | |||
| + | ^ Example | ||
| + | | x = "Hello World" | ||
| + | | x = 20 | int | | ||
| + | | x = 20.5 | float | | ||
| + | | x = 1j | complex | ||
| + | | x = [" | ||
| + | | x = (" | ||
| + | | x = range(6) | ||
| + | | x = {" | ||
| + | | x = {" | ||
| + | | x = frozenset({" | ||
| + | | x = True | bool | | ||
| + | | x = b" | ||
| + | | x = bytearray(5) | ||
| + | | x = memoryview(bytes(5)) | ||
| + | |||
| + | ref: https:// | ||
| + | |||
| + | ### Class | ||
| + | ref: | ||
| + | |||
| + | ## Create a list of objects from a class | ||
| ```python | ```python | ||
| - | | + | swatchList = [] |
| - | swatchList.append(Swatch(" | + | |
| - | # Swatch is the name of the class | + | |
| ``` | ``` | ||
| <wrap lo> | <wrap lo> | ||
| Line 10: | Line 33: | ||
| </ | </ | ||
| - | ### Format Variables | + | ## Format Variables |
| ```python | ```python | ||
| | | ||
| | | ||
| | | ||
| + | # f:float, x:hex, s:string | ||
| ``` | ``` | ||
| The three lines above give the same result ````hue = 220.00````.\\ | The three lines above give the same result ````hue = 220.00````.\\ | ||
| Line 25: | Line 49: | ||
| - | ### Plot (matplotlib) | + | ## Plot (matplotlib) |
| py37-matplotlib has the following notes:\\ | py37-matplotlib has the following notes:\\ | ||
| The default backend is the interactive Mac OS X backend. Different backends can be specified using the | The default backend is the interactive Mac OS X backend. Different backends can be specified using the | ||
| Line 31: | Line 55: | ||
| https:// | https:// | ||
| + | ```python | ||
| + | import matplotlib.pyplot as plt | ||
| + | plt.plot(x, y, color=' | ||
| + | ``` | ||
| + | |||
| + | Note: ```markerfacecolor``` accept RGB, HEX and simple color text description: | ||
| + | |||
| + | ### 3D plot: | ||
| + | https:// | ||
| - | ### Common Error | + | ## Common Error |
| ```python | ```python | ||
| File " | File " | ||
python.1578035315.txt.gz · Last modified: (external edit)
