python3学习手册
设置对象的属性 geta�r() 获取对象的属性 a = A() >>> geta�r(a, 'bar') # 获取属性 bar 值 1 >>> seta�r(a, 'bar', 5) # 设置属性 bar 值 >>> a.bar 5 next() 返回迭代器的下一个项目。 next() 函数要和生成迭代器的 iter() 函数一起使用 id() ell窗口 cmd> pip3 install requests #使用 import requests response = requests.get("http://sysyear.top:4600") print(type(response.text)) # 类型为str response.encoding = "utf-8" # 指定返回数据的文本编码 返回http头部信息,单行字典类型 print(response.text) # 返回正文内容,多行文本 import requests myurl = "http://sysyear.top:4600" myheaders = { "Accept": "application/json", "Content-Type": "application/json;charset=utf8"0 码力 | 213 页 | 3.53 MB | 1 年前3
共 1 条
- 1