User Tools

Site Tools


sidebar_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
sidebar_python [2024/05/17 11:11] waltersidebar_python [2024/06/01 15:05] (current) walter
Line 1: Line 1:
 ====== Übersicht Python ====== ====== Übersicht Python ======
  
 +  * [[python_json|JSON Handling]]
 +  * [[python_sort|Sortieren von list/dictionary]]
 +  * [[python_terminalsize|Terminal-Breite/Höhe bestimmen]]
 +  * [[python_qtableview|QTableview]]
  
- 
-<code python> 
-import json 
-</code> 
- 
-**LOAD** 
- 
-<code python> 
-json_data = '[{"ID":10,"Name":"Pankaj","Role":"CEO"},{"ID":20,"Name":"David Lee","Role":"Editor"}]' 
-json_object = json.loads(json_data) 
- 
-with open('Cars.json', 'r') as json_file: 
-    json_object = json.load(json_file) 
-</code> 
- 
-**SAVE** 
- 
-<code python> 
-with open('data.json', 'w', encoding='utf-8') as f: 
-    json.dump(data, f, ensure_ascii=False, indent=4) 
-</code> 
- 
-**PRINT** 
- 
-<code python> 
-print(json_object) 
-print(json.dumps(json_object)) 
-print(json.dumps(json_object, indent=1))  # pretty print 
-</code> 
sidebar_python.1715944296.txt.gz · Last modified: 2024/05/17 11:11 by walter