
python
能c能v
这个作者很懒,什么都没留下…
展开
-
python 使用django框架 出现 django.core.exceptions.SuspiciousFileOperation 异常解决
**1 异常表现**django.core.exceptions.SuspiciousFileOperation: The joined path is located outside of the base path component.2 解决方案在静态文件有 os.path.join(HERE, ‘static/’)将 里的 “/” 去掉 os.path.join(HERE, ...原创 2019-05-07 12:41:47 · 2337 阅读 · 0 评论 -
python 基础入门小游戏(石头剪刀布)
1.知识点:random函数,循环语句,函数调用。import randomdef play(): diannao = random.randint(1, 3) return diannaodef main(): while True: diannao = play() # print(diannao) Pers...原创 2019-06-05 22:25:07 · 832 阅读 · 0 评论 -
python 文件读写、列表(list),字典(dict) 保存为 文本文件(txt)和 json文件格式
1.列表(list)保存为txt。#list转txtlist = ['a','b','c','d']filename = open('D:\\soft\\Anaconda3\\list.txt','w') for i in list: filename.write(i) filename.write('\n')filename.close()2.字典(dic...原创 2019-06-07 22:09:28 · 14943 阅读 · 0 评论 -
python request 爬虫爬取起点中文网小说
1.网页分析。进入https://www.qidian.com/,点击全部,进行翻页,你就会发现一个规律,url=https://www.qidian.com/all?orderId=&style=1&pageSize=20&siteid=1&pubflag=0&hiddenField=0&page=0(1,2,3,……)那么我么可以这...原创 2019-06-14 14:16:35 · 2127 阅读 · 3 评论 -
python requests+lxml+xpath 爬取豆瓣top250电影图片
1.爬取豆瓣电影网页源码。import requestsurl = 'https://movie.douban.com/top250?start='+str(start)+'&filter='data = requests.get(url)# print(data.text)2.分析网页结构,爬取图片src,https://movie.douban.com/top2...原创 2019-06-09 20:02:32 · 863 阅读 · 0 评论 -
python爬虫爬取百度贴吧——高考吧图片
话不多说,直接上代码。mport urllib.requestimport refrom lxml import etreedef gethtml(start): #str(start)=0表示第一页,50表示第二页,……。 url = 'http://tieba.baidu.com/f?kw=%E9%AB%98%E8%80%83&ie=utf-8&p...原创 2019-06-11 16:04:30 · 176 阅读 · 0 评论