封装与调用
__init__参数传递,url提取
import requests import re class Test(): def __init__(self,s): self.s = s def bb(self,url): r=self.s = s.get(url,verify=False) print(r.text) if __name__ == '__main__': s = requests.session() aa = Test(s) url = "https://jctcg.9caitong.com/" aa.bb(url)