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KKKKACiiigAoo ooAq31/Fp8IklWVyxKxxwxl3dsE4AHsD14rnLvxJf7ZreNLa1mcAxNcOBKm4javkoXZmwQc4HuOO dbxPax3OgXBlhSZYds5RztyEIZgCBkEqGGR61xQn1JZPIhgvElzK4trYJZxb04dV2EmfBGOCGwPf jGpJp2A9IgmWeFZF4zwVyCVI4KnBIyDkHnqKkrnPCN1G9vc2cXkeTC4khFvJvRY3GQuT827IbIYA 8+mAOjrSLurgFFFFUAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAMmaRIJHij82RVJVN23ccc DPbNcxJFdWVpeTzQXzz3lxIwht4klYx4wqyEqwAHTAJ4bvzjqqKAOGghMeqSW1nLbfabpVKKk7xI pVRlXWPaQw+bqADnPykFT3NRS21vPJHJNBFI8RzGzoCUPqM9Og/KpabYBRRRSAKKKKACiiigAooo oAKKKKACiiigAooooAKKKKAKeq2017pdxaQOiPOnllnBIVW4Y4HfaTj3xTYNLghuJptqkvcm5QKN uxjGEPTrn5j/AMC/Gr1FKyvcCvbWNnZbvslpBBvxu8qMLux0zj6mrFFFMAooooAKKKKACiiigAoo ooA//9k=‘‘‘ img_data = base64.b64decode(data) with open(‘img.png‘, ‘wb‘) as f: f.write(img_data)
这样就可以在当前目录下生成一张名为img的图片啦