파이썬 데이터 입출력

곽태욱·2020년 4월 16일
0

dict -> json 문자열

jsonFile = {
    "IPAddress": clientAddress[0],
    "PortNumber": clientAddress[1]
}
jsonData = json.dumps(jsonFile, indent=4)

json 문자열 -> dict

 json_data = json.loads(json_file)

    # 문자열
    # key가 json_string인 문자열 가져오기
    json_string = json_data["json_string"]
profile
이유와 방법을 알려주는 메모장 겸 블로그. 블로그 내용에 대한 토의나 질문은 언제나 환영합니다.

0개의 댓글