import json json_encode = json.dumps json_decode = json.loads a = '{"a":123}' b = json_decode(a) c = json_encode(b) print 'original:'+a+'\n' print 'decoded:' + str(b) + '\n' print 'encoded' + c + '\n'
实现explode >>> str = 'a|b|c|d|e' >>> str.split("|") ['a', 'b', 'c', 'd', 'e'] 实现implode >>> list = ['a', 'b', 'c', 'd', 'e'] >>> "|".join(list) 'a|b|c|d|e'