반응형
TypeError: b'Pizza is a flatbread generally topped with tomato sauce and cheese and baked in an oven. It is commonly topped with a selection of meats, vegetables and condiments. The term was first recorded in the 10th century, in a Latin manuscript from Gaeta in Central Italy. The modern pizza was invented in Naples, Italy, and the dish and its variants have since become popular in many areas of the world.\nIn 2009, upon Italy\'s request, Neapolitan pizza was safeguarded in the European Union as a Traditional Speciality Guaranteed dish. The Associazione Verace Pizza Napoletana (the True Neapolitan Pizza Association) is a non-profit organization founded in 1984 with headquarters in Naples. It promotes and protects the "true Neapolitan pizza".\nPizza is sold fresh, frozen or in portions, and is a common fast food item in North America and the United Kingdom. Various types of ovens are used to cook them and many varieties exist. Several similar dishes are prepared from ingredients commonly used in pizza preparation, such as calzone and stromboli.' is not JSON serializable
나는 이것을 JSON 문자열에 추가하는 프로그램을 가지고 있는데, 이것은 대부분의 텍스트 문자열에서 잘 작동하지만 이것은 분명히 아닙니다. 왜 안되는지 또는 어떻게 고칠 지 말할 수 있습니까?
해결 방법
이것은 문자열이 아니라 바이트 시퀀스입니다. JSON은 바이트 시퀀스가 아닌 유니 코드 문자열을 처리하는 방법 만 알고 있습니다. 유니 코드 ( json.dumps (x.decode ( "utf-8"))
)로 변환하거나 정수 배열 ( json.dumps (list (x))
).
참조 페이지 https://stackoverflow.com/questions/36212905
반응형
'파이썬' 카테고리의 다른 글
파이썬 시간 모듈로 경과 시간 측정 (0) | 2020.11.07 |
---|---|
파이썬 ImportError : mysite.settings (Django)라는 모듈이 없습니다. (0) | 2020.11.07 |
파이썬 pandas DataFrame, 특정 열에 함수를 적용하는 방법은 무엇입니까? (0) | 2020.11.07 |
파이썬 pyspark에서 Python 라이브러리를 얻으려면 어떻게해야합니까? (0) | 2020.11.07 |
파이썬 Pandas 데이터 프레임에서 NaN 값이 포함 된 열을 찾는 방법 (0) | 2020.11.07 |
댓글