- 博客(5)
- 收藏
- 关注
原创 Python小白进阶——网络爬虫之下载网页图片
import os,requestsfrom bs4 import BeautifulSoupfrom urllib.request import urlopen url = 'http://33-22.lofter.com/post/1cd8ec46_12ba6f89'html = requests.get(url)html.encoding = 'utf-8'sp = Bea...
2018-08-22 18:41:58 1065 1
原创 Python小白进阶——bisect函数了解一下
"""bisect 为可排序序列提供二分查找算法"""import bisect#使用bisect函数前需要对列表进行排序,否则虽然可以输出数值,但没有意义a = [1, 5, 6, 10, 9]a.sort()print("最初的列表:", a)#bisect.bisect 返回某个数在列表中可以插入的位置,但不会插入该数。#如果这个数与列表中的元素相同,则返回元素后面的位...
2018-09-15 12:17:06 2288
原创 Python小白进阶——TypeError: replaceSpace() missing 1 required positional argument: 'self'
# -*- coding:utf-8 -*-class Solution: # s 源字符串 def replaceSpace(self, s): # write code here s = list(s)k = 'Hello World'a = Solutiona.replaceSpace(s = k)上面这段代码会报错“TypeErr...
2018-09-14 19:51:57 16246
原创 Python小白进阶——django无法创建项目的解决方式
在虚拟环境里使用“django-admin.py startproject learning_log .”命令创建项目,发现无法创建,同时没有任何报错。 在网上查了各种方法,最后解决方式如下: 1、在创建的虚拟环境文件夹中找到“django-admin.py”文件。路径通常为“ ‘虚拟环境名称’\Lib\site-packages\django\bin ” 2、将该文件的打开方式设置...
2018-09-03 21:21:07 5429 2
原创 Python小白进阶——解决“SyntaxError: non-default argument follows default argument”
代码:def describe_pets(animal_type = 'dog', pet_name): print("\nI have a " + animal_type + ".") print("My " + animal_type + "'s name is " + pet_name) describe_pets(pet_name = 'kane')错误提示: ...
2018-08-30 20:45:59 16611 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人