上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要: class Baby(): country='China' #类变量,公共的变量 def __init__(self,name): print('self的内存地址',id(self)) self.name=name # self代表的就是实例化之后的对象 self.money=5000 self. 阅读全文
posted @ 2018-05-25 18:21 彼得潘jd 阅读(154) 评论(0) 推荐(0)
摘要: from urllib import parseurl='http://www.baidu.com?qurey=python基础教程 @@@'# url_str=parse.quote_plus(url) #url编码print(parse.quote_plus(url))from urllib i 阅读全文
posted @ 2018-05-25 18:19 彼得潘jd 阅读(457) 评论(0) 推荐(0)
摘要: class Person: #类名首字母大写 #经典类 def __init__(self): #构造函数 self.nose=1 #鼻子 #属性 self.face= 1 #脸 self.head= 1 #脑子 self.wing = 4 #翅膀 def driver(self): print(' 阅读全文
posted @ 2018-05-25 18:14 彼得潘jd 阅读(153) 评论(0) 推荐(0)
摘要: import yagmailusername='XXXXXXXXXX@qq.com' #邮箱passwd='XXXXXXXXX' #授权码mail=yagmail.SMTP(user=username, password=passwd, host='smtp.qq.com', #如果是163邮箱写成 阅读全文
posted @ 2018-05-25 18:11 彼得潘jd 阅读(102) 评论(0) 推荐(0)
摘要: # 2、http://doc.xxx.cn/index.php?s=/5&page_id=17# 这个抽奖接口,每天只能抽奖3次,而且必须先登录才能抽奖## 1、写一个函数,让他自动抽奖# 1、先登录,获取到sign\userid# 2、然后再调用抽奖接口,把sign\userid传过来# 3、抽奖 阅读全文
posted @ 2018-05-20 17:59 彼得潘jd 阅读(420) 评论(0) 推荐(0)
摘要: # 2、http: // doc.nnzhp.cn / index.php?s = / 6 & page_id = 14# 调用获取学生信息的接口,保存到excel里面import requests,xlwtdef get_stu_info(): url='http://api.xxx.cn/api 阅读全文
posted @ 2018-05-20 17:57 彼得潘jd 阅读(169) 评论(0) 推荐(0)
摘要: #zipl1=['a','b','c','d','e','f']l2=[1,2,3]print(list(zip(l1,l2)))l3=['A','B','C']## #zip把两个list,合并到一起,如果想同时循环2个list的时候,for a,b,c in zip(l1,l2,l3): pri 阅读全文
posted @ 2018-05-18 11:17 彼得潘jd 阅读(133) 评论(0) 推荐(0)
摘要: import requests# 1、发get请求url='http://api.xxx.xx/api/user/sxx_info'data={'stu_name':'xxx'}req=requests.get(url,params=data) #发get请求print(req.json()) #字 阅读全文
posted @ 2018-05-18 11:16 彼得潘jd 阅读(177) 评论(0) 推荐(0)
摘要: from urllib import request,parseurl='http://www.xxx.cn'req=request.urlopen(url) #打开一个url,发get请求content=req.read().decode()fw=open('baidu.html','w',enc 阅读全文
posted @ 2018-05-18 10:59 彼得潘jd 阅读(95) 评论(0) 推荐(0)
摘要: res=5/0print(res)import randomguess=random.randint(10,20)print(type(guess))num=input('please enter a num:')print(num+guess)d={'price':20}price=input(' 阅读全文
posted @ 2018-05-18 10:56 彼得潘jd 阅读(103) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页