BackEnd/Automation Program with Python
import simplejson as json # import json #Dict(json) 선언 data = {} data['people'] = [] data['people'].append({ 'name':'KUK', 'website':'naver.com', 'from':'seoul' }) data['people'].append({ 'name':'Lee', 'website':'google.com', 'from':'kyungki' }) data['people'].append({ 'name':'park', 'website':'daum.net', 'from':'pusan' }) print(data) # data = {'people': [{'name': 'KUK', 'website': 'naver.com', ..
BackEnd/Automation Program with Python
import pickle #(객체, 텍스트) 직렬화, 역직렬화 # 파일이름과 데이터 bfilename = 'C:/test.bin' tfilename = 'C:/test.txt' data1 = 77 data2 = 'hello world' data3 = ['car', 'apple', 'house'] # 바이너리 쓰기 with open(bfilename, 'wb') as f: pickle.dump(data1,f) #dumps(문자열 직렬화) pickle.dump(data2,f) pickle.dump(data3,f) # 텍스트 쓰기 with open(tfilename, 'wt') as f: f.write(str(data1)) f.write('\n') f.write(data2) f.write('\n') f.wri..