def check_obj(obj, title):
if pprint.isreadable(obj):
logging.info(title + " is readable")
else:
logging.info(title + " is NOT readable")
try:
json.dumps(obj)
logging.info(title + " is JSON serializable")
except TypeError as err:
logging.error(title + " is not JSON serializable")
logging.error(err)
try:
s=pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
pickle.loads(s)
logging.info(title + " can be pickled")
except:
logging.error(title + " could not be picked and unpickled")
评论列表
文章目录