python3中字节repr()的反转操作是什么?

时间:2016-07-04 08:45:42

标签: python python-3.x

a = b'\x00\x01'
ra = repr(a)   # ra == "b'\\x00\\x01'"
assert invert_repr(ra) == a

invert_repr的正确形式是什么? string_escape& unicode_escape?

1 个答案:

答案 0 :(得分:3)

使用var submit = { preloader_id: "", send:function (form_id) { var _this = this; // store here var url = $(form_id).attr("action"); $.ajax({ type: "POST", url: url, data: $(form_id).serialize(), dataType: 'json', success:(result) => {}, error: function(result) { // Some errors }, beforeSend: function() { // use here... console.log(_this.preloader_id); if (_this.preloader_id != "") { run_preloader(_this.preloader_id); } }, completes: function() { // and here... if (_this.preloader_id != "") { run_preloader(_this.preloader_id, 'true'); } } }); } } 或同等效果:

eval

ast.literal_eval is safer than eval.