User Tools

Site Tools


python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python [2021/08/02 18:56] – [Chaining] utedasspython [2022/12/05 16:26] (current) utedass
Line 4: Line 4:
   * pyserial -- Comport   * pyserial -- Comport
   * matplotlib -- Matlabliknande plotverktyg   * matplotlib -- Matlabliknande plotverktyg
-  * numpy -- Matlabliknande matte+  * [[python:numpy]] -- Matlabliknande matte
   * pandas -- Importera och exportera till olika filformat, ex CSV, tydligen också för att behandla data   * pandas -- Importera och exportera till olika filformat, ex CSV, tydligen också för att behandla data
  
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 ''mylist = [x*x for x in range(3)]'' och när kan den användas? 
 +  * ^ Verkar vara [[https://www.w3schools.com/python/python_lists_comprehension.asp|List comprehensions]]
 ====== Cheat sheet ====== ====== Cheat sheet ======
  
Line 28: Line 30:
 populated_tuple = (1, 2, "Kalle", 4.32) populated_tuple = (1, 2, "Kalle", 4.32)
 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['shit'] leet = my_dict['shit']
 +
 +# 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:
  
  
-====== Parser ======+====== Argument parser ======
  
 <code python> <code python>
Line 255: Line 262:
 print(my_instance.my_property) # Prints 300 print(my_instance.my_property) # Prints 300
 </code> </code>
 +
 +
 +====== tkinter ======
 +[[https://tkdocs.com/tutorial/menus.html|Good site]]
 +
 +[[https://tcl.tk/man/tcl8.6/TkCmd/contents.htm|tk reference]]
 +
 +[[https://web.archive.org/web/20200201190621/http://effbot.org/tkinterbook/text.htm|Archived tutorial from effbot.org]]
  
python.1627930598.txt.gz · Last modified: 2022/09/12 00:30 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki