
python
Tuzi294
这个作者很懒,什么都没留下…
展开
-
Python笔记
1、expected an indented block问题:python是一门对缩进很要求很高的语言,而且有没有缩进用肉眼无法辨别。编程过程中遇到题目的错误提示,就是缩进有问题。一般冒号后面都要有缩进。例如,def、if、for等还有中文和英文的符号是不一样的,这个如果错误了很难检查出来。 2、在windows窗口中打开终端: 1)在文件夹的窗口中空白出按shift+右键,打开命令行窗口原创 2016-08-28 13:48:03 · 514 阅读 · 0 评论 -
python学习笔记(二)
隔了好久,终于再发了一篇博客啦~在廖雪峰老师的教程下学习python,学到精彩的地方忍不住要做一下笔记。问题:利用列表生成式和generator写一个杨辉三角,每次输出一行。代码如下 # -*- coding: utf-8 -*-def triangles(): L=[1] while True: yield L L=[sum(i) for原创 2016-08-28 13:48:25 · 567 阅读 · 0 评论 -
查找包含某字符串的文件 - (python/shell)
# -*- coding: utf-8 -*-import osimport reimport codecsdef iter(path): for home, dirs, files in os.walk(path): for filename in files: yield os.path.join(home, filename)de原创 2017-03-22 23:06:02 · 1557 阅读 · 0 评论 -
使用python的turtle库画图
引、想要使用python作画吗? 那就用turtle库吧,使用它可以在屏幕的画板上绘制出各种图像。操控这只turtle(海龟)在屏幕上爬行,根据坐标定位,沿途的足迹,就是你想要的图像。一、使用方法:1、引入方式(两种):import turtle #导入turtle库,使用时通过turtle.function调用from turtle import * #导入turtle库中所有方法,直接通过f原创 2017-10-10 23:12:55 · 6621 阅读 · 2 评论 -
利用python-opencv 进行图像的二值化处理
准备工作1、环境:Python3.62、安装opencv: 命令行输入 pip install python-opencv 直接安装 若无pip命令,则将python下的Script目录加入环境变量,或者直接再该文件夹下运行命令。代码import cv2 #导入cv2包path = 'd:\\testdata\\test\\test1.jpg' #图片路...原创 2018-04-14 22:45:30 · 3401 阅读 · 0 评论 -
基于投影的图像文字分割 - python
环境python 3.6 python-opencv 3.4.0思路对图片进行水平方向投影,得到每一行文字的起止线 对每一行文字进行竖直方向投影,若有连续的像素满足条件,则为一个字,进行分割代码import cv2import numpy as nppath = 'd:\\testdata\\test\\bin1.png'root = 'd:\\testdat...原创 2018-04-16 12:59:38 · 7597 阅读 · 6 评论 -
python - BeautifulSoup解析html页面
。原创 2019-05-16 17:44:46 · 540 阅读 · 0 评论