Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
rb:python [21/05/2019 14:23]
andrew [Python]
rb:python [24/06/2019 11:13]
andrew [Lists and Dicts]
Line 6: Line 6:
 ===== Formatting ===== ===== Formatting =====
  
 +<code python>
 >>>​ print ("this is a {LENGTH} {STRING} print"​).format(LENGTH='​short',​ STRING='​test'​) >>>​ print ("this is a {LENGTH} {STRING} print"​).format(LENGTH='​short',​ STRING='​test'​)
 this is a short test print this is a short test print
 >>> ​ >>> ​
 +</​code>​
 ===== Virtual Environment ===== ===== Virtual Environment =====
  
Line 24: Line 24:
  
 pip freeze > requirements.txt pip freeze > requirements.txt
 +
 +
 +===== Lists and Dicts =====
 +
 +
 +==== List ====
 +
 +uses comma as sep and square brackets
 +
 +<code python>
 +list = ["​value1",​ "​value2"​]
 +</​code>​
 +
 +
 +==== Dictionary ====
 +
 +
 +uses ":"​ and curly brackets
 +
 +<code python>
 +dict = { "​key1":​ "​value1",​ "​key2":​ "​value2"​ }
 +</​code>​
  

rb/python.txt ยท Last modified: 25/09/2019 15:38 by andrew