Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Biểu diễn Python Tuple trong JSON format

JSON không khái niệm tuple. json module convert tuple → JSON list (immutable không保留). Muốn保留: dùng pickle (file .pkl) hoặc custom encoder/decoder phân biệt list/tuple.

Pickle không dùng cho web transfer. Best: custom encoder/decoder.