import json data = { 'name': 'ACME', 'shares': 100, 'price': 542.23 } json_str = json.dumps(data) data = json.loads(json_str) # Writing JSON data with open('data.json', 'w') as f: json.dump(data, f) # Reading data back with open('data.json', 'r') as f: data = json.load(f) json.dumps(False) # 'false' d = {'a': True, 'b': 'Hello', 'c': None} json.dumps(d) # '{"b": "Hello", "C": null, "a": true}' s..
print(value, sep=' ', end='\n', file=sys.stdoutput, flush=False) with open('somefile.txt', 'wt') as f: print('hello world', file=f) Binary Data 읽고/쓰기 with open('somefile.bin', 'rb') as f: data = f.read() with open('somefile.bin', 'wb') as f: f.write(b'Hello World') t = "Hello World" t[0] # H for c in t: print(c) """ H e l l o """ b = b'Hello World' b[0] # 72 for c in b: print(c) """ 72 101 108 1..