python
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python [2021/08/02 19:36] – [Bra moduler] utedass | python [2022/12/05 16:26] (current) – utedass | ||
|---|---|---|---|
| Line 18: | Line 18: | ||
| * Hur man läser syntaxguide i pythons dokumentation | * Hur man läser syntaxguide i pythons dokumentation | ||
| * Hur man använder context managers | * Hur man använder context managers | ||
| + | * Vad är generators, hur fungerar yield | ||
| + | * Vem fan kom på syntaxen '' | ||
| + | * ^ Verkar vara [[https:// | ||
| ====== Cheat sheet ====== | ====== Cheat sheet ====== | ||
| Line 28: | Line 30: | ||
| populated_tuple = (1, 2, " | populated_tuple = (1, 2, " | ||
| singleton_tuple = (3,) | singleton_tuple = (3,) | ||
| + | print(populated_tuple[2]) # Prints Kalle | ||
| # Ranges are also immutable | # Ranges are also immutable | ||
| Line 55: | Line 58: | ||
| all_keys = list(my_dict) | all_keys = list(my_dict) | ||
| leet = my_dict[' | leet = my_dict[' | ||
| + | |||
| + | # Dictionaries can be unpacked and used as arguments to a function | ||
| + | dude = {a: 4, b: 5} | ||
| + | function_that_takes_a_and_b(**dude) | ||
| # Set types must contain hashable objects. They are not ordered and cannot be indexed | # Set types must contain hashable objects. They are not ordered and cannot be indexed | ||
| Line 97: | Line 104: | ||
| - | ====== | + | ====== |
| <code python> | <code python> | ||
| Line 255: | Line 262: | ||
| print(my_instance.my_property) # Prints 300 | print(my_instance.my_property) # Prints 300 | ||
| </ | </ | ||
| + | |||
| + | |||
| + | ====== tkinter ====== | ||
| + | [[https:// | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | [[https:// | ||
python.1627932982.txt.gz · Last modified: 2022/09/12 00:30 (external edit)
