网站开发前景如何,吉林网站建设找哪家,如皋网站建设公司,二维码生成器表白文字python中用于RSA加解密的库有好久个#xff0c;本文主要讲解rsa、M2Crypto、Crypto这三个库对于RSA加密、解密、签名、验签的知识点。
知识基础
加密是为了保证传输内容隐私#xff0c;签名是为了保证消息真实性。
服务器存私钥#xff0c;客户端存公钥。#xff08;服务…python中用于RSA加解密的库有好久个本文主要讲解rsa、M2Crypto、Crypto这三个库对于RSA加密、解密、签名、验签的知识点。
知识基础
加密是为了保证传输内容隐私签名是为了保证消息真实性。
服务器存私钥客户端存公钥。服务器和客户端关系可以考虑为 1:N
客户端往服务器传输内容更多考虑是隐私性所以公钥签名、私钥解密。
服务器往客户端传输内容更多考虑真实性所以私钥签名公钥验签。
消息的摘要生的算法常用的是MD5或者SHA1消息内容不一样生成的摘要信息一定不一样。
真实性的考虑一方面是内容由私钥拥有者发出另一方面内容在传输过程中没有改变过所以签名的对象是传输信息生成的消息摘要摘要内容短签名也会快些。
每次加密的长度需要小于密钥长度-特殊位128位公钥最长可加密128-11117位明文。
每次解密的长度需要小于密钥的长度128位私钥解密解密密文长度需要小于等于128位。
如果加解密内容过长就需要分段加密、解密。
PEM格式的密钥为base64位文本格式。
环境配置
环境MAC
python版本2.7.15因为公司用的版本都是这个建议用python3的
IEDPyCharm
密钥PEM文件
rsa
示例代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 # -*- coding: UTF-8 -*- # ! /usr/bin/env python import base64 import rsa from rsa import common # 使用 rsa库进行RSA签名和加解密 class RsaUtil(object): PUBLIC_KEY_PATH /Users/anonyper/Desktop/key/company_rsa_public_key.pem # 公钥 PRIVATE_KEY_PATH /Users/anonyper/Desktop/key/company_rsa_private_key.pem # 私钥 # 初始化key def __init__(self, company_pub_filePUBLIC_KEY_PATH, company_pri_filePRIVATE_KEY_PATH): if company_pub_file: self.company_public_key rsa.PublicKey.load_pkcs1_openssl_pem(open(company_pub_file).read()) if company_pri_file: self.company_private_key rsa.PrivateKey.load_pkcs1(open(company_pri_file).read()) def get_max_length(self, rsa_key, encryptTrue): 加密内容过长时 需要分段加密 换算每一段的长度. :param rsa_key: 钥匙. :param encrypt: 是否是加密. blocksize common.byte_size(rsa_key.n) reserve_size 11 # 预留位为11 if not encrypt: # 解密时不需要考虑预留位 reserve_size 0 maxlength blocksize - reserve_size return maxlength # 加密 支付方公钥 def encrypt_by_public_key(self, message): 使用公钥加密. :param message: 需要加密的内容. 加密之后需要对接过进行base64转码 encrypt_result b max_length self.get_max_length(self.company_public_key) while message: input message[:max_length] message message[max_length:] out rsa.encrypt(input, self.company_public_key) encrypt_result out encrypt_result base64.b64encode(encrypt_result) return encrypt_result def decrypt_by_private_key(self, message): 使用私钥解密. :param message: 需要加密的内容. 解密之后的内容直接是字符串不需要在进行转义 decrypt_result b max_length self.get_max_length(self.company_private_key, False) decrypt_message base64.b64decode(message) while decrypt_message: input decrypt_message[:max_length] decrypt_message decrypt_message[max_length:] out rsa.decrypt(input, self.company_private_key) decrypt_result out return decrypt_result # 签名 商户私钥 base64转码 def sign_by_private_key(self, data): 私钥签名. :param data: 需要签名的内容. 使用SHA-1 方法进行签名也可以使用MD5 签名之后需要转义后输出 signature rsa.sign(str(data), priv_keyself.company_private_key, hashSHA-1) return base64.b64encode(signature) def verify_by_public_key(self, message, signature): 公钥验签. :param message: 验签的内容. :param signature: 对验签内容签名的值签名之后会进行b64encode转码所以验签前也需转码. signature base64.b64decode(signature) return rsa.verify(message, signature, self.company_public_key) message hell world print(明文内容 ) print(message) rsaUtil RsaUtil() encrypy_result rsaUtil.encrypt_by_public_key(message) print(加密结果 ) print(encrypy_result) decrypt_result rsaUtil.decrypt_by_private_key(encrypy_result) print(解密结果 ) print(decrypt_result) sign rsaUtil.sign_by_private_key(message) print(签名结果 ) print(sign) print(验签结果 ) print(rsaUtil.verify_by_public_key(message, sign)) #执行结果 明文内容 hell world 加密结果 sWx9r30CCLXip0iemCb2r1gsZIedgLp1Vmk9uCDaQttcQNftwQyI98shN2Hpn7snE27ziJnH6qYmaf68TWBerhJVGEzr16wLYInVft0Bj0kcCmLL7tMJRZWydqHi/YzgIfsFEvqLOUFv6E9bCAXhJkikacBAG4FWTMBrXUQHjE 解密结果 hell world 签名结果 GS3MPpb4zMLIL7mqcxZEevOoH1Fse9fjHefWIUpDaMplhoPUNK85TreYmOwvF8QJNxgLcJoKKfRm51gemsQd1/e1FBPo/4VS3kvneJyLUtQAPdOOlR4h//0gFecELIKS8A74Dkm2bFKztZ4BxIcWD63pHRiGAnS8cQeq2QM 验签结果 True 知识点
rsa计算密钥长度的方式是 common.byte_size(rsa_key.n)rsa加密rsa.encrypt(message, pub_key)rsa解密rsa.decrypt(crypto, priv_key)rsa签名rsa.sign(message, priv_key, hash)rsa验签rsa.verify(message, signature, pub_key)rsa默认没有私钥加密公钥解密的方法加解密传入错误的key会报错如果想实现私钥加密公钥解密可以自行模拟底层代码实现签名只能用私钥用到私钥的n值公钥没有n值n、d、e具体什么意思请百度RSA算法原理rsa加载公钥和私钥的方法不同rsa私钥签名时需要传入的是不是具体的摘要信息字符串而是签名信息的hash对象对象不同版本的rsa验签成功之后返回结果不一样有的是True有的是返回生成摘要算法名如sha1
Crypto
示例代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 # -*- coding: UTF-8 -*- # ! /usr/bin/env python import base64 from Crypto.Cipher import PKCS1_v1_5 as PKCS1_v1_5_cipper from Crypto.Signature import PKCS1_v1_5 from Crypto.PublicKey import RSA from Crypto.Hash import SHA import Crypto # 使用 rsa库进行RSA签名和加解密 class RsaUtil(object): PUBLIC_KEY_PATH /Users/anonyper/Desktop/key/company_rsa_public_key.pem # 公钥 PRIVATE_KEY_PATH /Users/anonyper/Desktop/key/company_rsa_private_key.pem # 私钥 # 初始化key def __init__(self, company_pub_filePUBLIC_KEY_PATH, company_pri_filePRIVATE_KEY_PATH): if company_pub_file: self.company_public_key RSA.importKey(open(company_pub_file).read()) if company_pri_file: self.company_private_key RSA.importKey(open(company_pri_file).read()) def get_max_length(self, rsa_key, encryptTrue): 加密内容过长时 需要分段加密 换算每一段的长度. :param rsa_key: 钥匙. :param encrypt: 是否是加密. blocksize Crypto.Util.number.size(rsa_key.n) / 8 reserve_size 11 # 预留位为11 if not encrypt: # 解密时不需要考虑预留位 reserve_size 0 maxlength blocksize - reserve_size return maxlength # 加密 支付方公钥 def encrypt_by_public_key(self, encrypt_message): 使用公钥加密. :param encrypt_message: 需要加密的内容. 加密之后需要对接过进行base64转码 encrypt_result b max_length self.get_max_length(self.company_public_key) cipher PKCS1_v1_5_cipper.new(self.company_public_key) while encrypt_message: input_data encrypt_message[:max_length] encrypt_message encrypt_message[max_length:] out_data cipher.encrypt(input_data) encrypt_result out_data encrypt_result base64.b64encode(encrypt_result) return encrypt_result # 加密 支付方私钥 def encrypt_by_private_key(self, encrypt_message): 使用私钥加密. :param encrypt_message: 需要加密的内容. 加密之后需要对接过进行base64转码 encrypt_result b max_length self.get_max_length(self.company_private_key) cipher PKCS1_v1_5_cipper.new(self.company_public_key) while encrypt_message: input_data encrypt_message[:max_length] encrypt_message encrypt_message[max_length:] out_data cipher.encrypt(input_data) encrypt_result out_data encrypt_result base64.b64encode(encrypt_result) return encrypt_result def decrypt_by_public_key(self, decrypt_message): 使用公钥解密. :param decrypt_message: 需要解密的内容. 解密之后的内容直接是字符串不需要在进行转义 decrypt_result b max_length self.get_max_length(self.company_public_key, False) decrypt_message base64.b64decode(decrypt_message) cipher PKCS1_v1_5_cipper.new(self.company_public_key) while decrypt_message: input_data decrypt_message[:max_length] decrypt_message decrypt_message[max_length:] out_data cipher.decrypt(input_data, ) decrypt_result out_data return decrypt_result def decrypt_by_private_key(self, decrypt_message): 使用私钥解密. :param decrypt_message: 需要解密的内容. 解密之后的内容直接是字符串不需要在进行转义 decrypt_result b max_length self.get_max_length(self.company_private_key, False) decrypt_message base64.b64decode(decrypt_message) cipher PKCS1_v1_5_cipper.new(self.company_private_key) while decrypt_message: input_data decrypt_message[:max_length] decrypt_message decrypt_message[max_length:] out_data cipher.decrypt(input_data, ) decrypt_result out_data return decrypt_result # 签名 商户私钥 base64转码 def sign_by_private_key(self, message): 私钥签名. :param message: 需要签名的内容. 签名之后需要转义后输出 cipher PKCS1_v1_5.new(self.company_private_key) # 用公钥签名会报错 raise TypeError(No private key) 如下 # if not self.has_private(): # raise TypeError(No private key) hs SHA.new(message) signature cipher.sign(hs) return base64.b64encode(signature) def verify_by_public_key(self, message, signature): 公钥验签. :param message: 验签的内容. :param signature: 对验签内容签名的值签名之后会进行b64encode转码所以验签前也需转码. signature base64.b64decode(signature) cipher PKCS1_v1_5.new(self.company_public_key) hs SHA.new(message) # digest hashlib.sha1(message).digest() # 内容摘要的生成方法有很多种只要签名和解签用的是一样的就可以 return cipher.verify(hs, signature) message hell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell world print(明文内容 ) print(message) rsaUtil RsaUtil() encrypy_result rsaUtil.encrypt_by_public_key(message) print(加密结果 ) print(encrypy_result) decrypt_result rsaUtil.decrypt_by_private_key(encrypy_result) print(解密结果 ) print(decrypt_result) sign rsaUtil.sign_by_private_key(message) print(签名结果 ) print(sign) print(验签结果 ) print(rsaUtil.verify_by_public_key(message, sign)) #执行结果 明文内容 hell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell world 加密结果 PC8/knkmszKby2pHtlKJa/Uv7EADImNhrFwZQK3YHpwPwDpt5A4bFTxsDu2o8U0ycX50M3Bi53C0sOHjiOCStG/Bp1nfowHQBgUFCETp4G3fpLAl7eWynqqu6gInjHQeNMbBz1wvRhSiXoMB2lJm8b9fLuzDuQQRFZPqD356kgTKnBMlju4HE4zMjAT8jMam5Z4EnmaRfX7kYDGzgaPgbkkGon354i3CRhuRWtpvQeXnmjZq8MpfDC6//L7I/vvw4/LMJhiQJkXUbGEgSok8yg6jZzGxbllcqn7DH5nkNZKkOnqaeJHbEktgdhua/QXJcRR/5Lm0Y8ovs54A 解密结果 hell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell world 签名结果 VinHhTiJfDvIgseJ0ZsmJcLkyDdx0323B6vMKMUHDlUF2HDWqQhEEoqmSstjsSfR/T4829t5DhtaJ5w1O7K7ZyP/yu/lupc8apmfYSIziozi3vPy20p/CYNaXAy0LLGOwrtVNn3jTaq7Gb0yI4/Zhin2jNmTk09g8Qx9rGI 验签结果 True 知识点
Crypto计算密钥长度的方法是 Crypto.Util.number.size(rsa_key.n) / 8一个字节8位Crypto导入密钥的方法是同一个 RSA.importKey(self, externKey, passphraseNone)externKey为密钥内容Crypto加密方法Crypto.Cipher.PKCS1_v1_5.new(key).encrypt(self, message)Crypto解密方法Crypto.Cipher.PKCS1_v1_5.new(key).decrypt(self, message)Crypto签名方法Crypto.Signature.PKCS1_v1_5.new(key).sign(self, mhash)Crypto验签方法Crypto.Signature.PKCS1_v1_5_cipper.new(key).verifyverify(self, mhash, S)Crypto公钥、私钥都可以互相加解密Crypto只能私钥签名公钥验签签名传入公钥会报错底层有key.has_private()判断Crypto私钥签名时需要传入的是消息的摘要内容所以摘要可以由不同的实现方式只要验签时摘要算法一致即可。Crypto验签之后成功返回结果True不知道会不会与其他的
M2Crypto
示例代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 # -*- coding: UTF-8 -*- # ! /usr/bin/env python import base64 import M2Crypto from M2Crypto import EVP # 使用 M2Crypto库进行RSA签名和加解密 class RsaUtil(object): PUBLIC_KEY_PATH /Users/anonyper/Desktop/key/company_rsa_public_key.pem # 公钥 PRIVATE_KEY_PATH /Users/anonyper/Desktop/key/company_rsa_private_key.pem # 私钥 # 初始化key def __init__(self, company_pub_filePUBLIC_KEY_PATH, company_pri_filePRIVATE_KEY_PATH): if company_pub_file: self.company_public_key M2Crypto.RSA.load_pub_key(company_pub_file) if company_pri_file: self.company_private_key M2Crypto.RSA.load_key(company_pri_file) def get_max_length(self, rsa_key, encryptTrue): 加密内容过长时 需要分段加密 换算每一段的长度. :param rsa_key: 钥匙. :param encrypt: 是否是加密. blocksize rsa_key.__len__() / 8 reserve_size 11 # if not encrypt: reserve_size 0 maxlength blocksize - reserve_size return maxlength # 加密 支付方公钥 def encrypt_by_public_key(self, encrypt_message): 使用公钥加密. :param encrypt_message: 需要加密的内容. 加密之后需要对接过进行base64转码 encrypt_result b max_length self.get_max_length(self.company_public_key) print(max_length) while encrypt_message: input_data encrypt_message[:max_length] encrypt_message encrypt_message[max_length:] out_data self.company_public_key.public_encrypt(input_data, M2Crypto.RSA.pkcs1_padding) encrypt_result out_data encrypt_result base64.b64encode(encrypt_result) return encrypt_result # 加密 支付方私钥 def encrypt_by_private_key(self, encrypt_message): 使用私钥加密. :param encrypt_message: 需要加密的内容. 加密之后需要对接过进行base64转码 encrypt_result b max_length self.get_max_length(self.company_private_key) while encrypt_message: input_data encrypt_message[:max_length] encrypt_message encrypt_message[max_length:] out_data self.company_private_key.private_encrypt(input_data, M2Crypto.RSA.pkcs1_padding) encrypt_result out_data encrypt_result base64.b64encode(encrypt_result) return encrypt_result def decrypt_by_public_key(self, decrypt_message): 使用公钥解密. :param decrypt_message: 需要解密的内容. 解密之后的内容直接是字符串不需要在进行转义 decrypt_result b max_length self.get_max_length(self.company_private_key, False) decrypt_message base64.b64decode(decrypt_message) while decrypt_message: input_data decrypt_message[:max_length] decrypt_message decrypt_message[max_length:] out_data self.company_public_key.public_encrypt(input_data, M2Crypto.RSA.pkcs1_padding) decrypt_result out_data return decrypt_result def decrypt_by_private_key(self, decrypt_message): 使用私钥解密. :param decrypt_message: 需要解密的内容. 解密之后的内容直接是字符串不需要在进行转义 decrypt_result b max_length self.get_max_length(self.company_private_key, False) decrypt_message base64.b64decode(decrypt_message) while decrypt_message: input_data decrypt_message[:max_length] decrypt_message decrypt_message[max_length:] out_data self.company_private_key.private_decrypt(input_data, M2Crypto.RSA.pkcs1_padding) decrypt_result out_data return decrypt_result # 签名 商户私钥 base64转码 def sign_by_private_key(self, message): 私钥签名. :param message: 需要签名的内容. 签名之后需要转义后输出 hs EVP.MessageDigest(sha1) hs.update(message) digest hs.final() # digest hashlib.sha1(message).digest() # 内容摘要的生成方法有很多种只要签名和解签用的是一样的就可以 signature self.company_private_key.sign(digest) # self.company_public_key.sign(digest) # 用公钥签名IDE会崩 return base64.b64encode(signature) def verify_by_public_key(self, message, signature): 公钥验签. :param message: 验签的内容. :param signature: 对验签内容签名的值签名之后会进行b64encode转码所以验签前也需转码. hs EVP.MessageDigest(sha1) hs.update(message) digest hs.final() # digest hashlib.sha1(message).digest() # 内容摘要的生成方法有很多种只要签名和解签用的是一样的就可以 signature base64.b64decode(signature) return self.company_public_key.verify(digest, signature) message hell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell world print(明文内容 ) print(message) rsaUtil RsaUtil() encrypy_result rsaUtil.encrypt_by_public_key(message) print(加密结果 ) print(encrypy_result) decrypt_result rsaUtil.decrypt_by_private_key(encrypy_result) print(解密结果 ) print(decrypt_result) sign rsaUtil.sign_by_private_key(message) print(签名结果 ) print(sign) print(验签结果 ) print(rsaUtil.verify_by_public_key(message, sign)) #执行结果 明文内容 hell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell world 加密结果 fu4RgyOaokEcLmA5k0otMirZoiFBDBkEgycgehEajtPUxP7Wf5rN05kwbsDNI7/kUR5wOvS0XE8jD1nYmKv4uBWfR5Z28BHdK20uue/8zTnPgdsAmRdzA6Lb2EIk/g38o2EtRZ4jILNOdikpW0kYpYRdaJgoHTWTOlE/RL9zcVKzYELFPpWui2jZ8EVMe6ZiPkRKCKL571f/OTb1qOdg4GTiowZCNMIknTxXawvZl9Funz7TNz0WsNDejLr3tM8erwhE0ygIMtemOiVy8yBVsHpHPzfdlNRoXXgtgupFEgVgEOODUp9y4LzX6UDf0i8uI7/SpyQoa9jSpcsIjA 解密结果 hell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell worldhell world 签名结果 VinHhTiJfDvIgseJ0ZsmJcLkyDdx0323B6vMKMUHDlUF2HDWqQhEEoqmSstjsSfR/T4829t5DhtaJ5w1O7K7ZyP/yu/lupc8apmfYSIziozi3vPy20p/CYNaXAy0LLGOwrtVNn3jTaq7Gb0yI4/Zhin2jNmTk09g8Qx9rGI 验签结果 1 知识点
M2Crypto计算密钥长度的方法是 rsa_key.len() / 8一个字节8位M2Crypto导入密钥的方法是不同 M2Crypto.RSA.load_pub_key(file)M2Crypto.RSA.load_key(file)//还有其他的不列举了使用load_key(file)传入公钥地址会报错。M2Crypto加密解密代码(RSA class下)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 def public_encrypt(self, data, padding): # type: (bytes, int) - bytes assert self.check_key(), key is not initialised return m2.rsa_public_encrypt(self.rsa, data, padding) def public_decrypt(self, data, padding): # type: (bytes, int) - bytes assert self.check_key(), key is not initialised return m2.rsa_public_decrypt(self.rsa, data, padding) def private_encrypt(self, data, padding): # type: (bytes, int) - bytes assert self.check_key(), key is not initialised return m2.rsa_private_encrypt(self.rsa, data, padding) def private_decrypt(self, data, padding): # type: (bytes, int) - bytes assert self.check_key(), key is not initialised return m2.rsa_private_decrypt(self.rsa, data, padding) 公钥和私钥具体实现RSA的代码1 2 3 4 5 6 7 8 9 10 11 12 13 class RSA_pub(RSA): Object interface to an RSA public key. #公钥调用下面方法直接报错 def private_encrypt(self, *argv): # type: (*Any) - None raise RSAError(RSA_pub object has no private key) #公钥调用下面方法直接报错 def private_decrypt(self, *argv): # type: (*Any) - None raise RSAError(RSA_pub object has no private key) M2Crypto签名和验签 sign(self, digest, algosha1):/verify(self, data, signature, algosha1):M2Crypto公钥、私钥都可以互相加解密M2Crypto只能私钥签名公钥验签签名传入公钥会报错公钥可以调用签名方法但是IDE崩溃了M2Crypto私钥签名时需要传入的是消息的摘要内容所以摘要可以由不同的实现方式只要验签时摘要算法一致即可。M2Crypto验签之后成功返回结果1不知道会不会与其他的
其他注意事项
base64位encode和decode时可以传入编码集UTF-8会将转化为u,将/转化为t在和服务器交互时‘’、‘’、‘/’ 等特殊字符可能会被转义造成客户端和服务器内容细微的不一致而导致验签失败尤其是两边使用的语言不通所以要协商好转义方案。 更多资讯或疑问内容添加小编微信 回复 “Python” 领取更多资料哦