
Python
tavatimsa
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
idea 一套代码提交到多个git上
1.点开Terminal2.查看远程仓库,只有一个github远程仓库git remoteorigingit remote -vorigin https://github.com/tavatimsa/test.git (fetch)origin https://github.com/tavatimsa/test.git (push)3.再添加一个远程仓库以gitee为例git remote add gitee https://gitee.com/tavatimsa/test.git4原创 2020-09-03 17:21:14 · 1484 阅读 · 0 评论 -
Python 练习 第 0014 题 第 0015 题 第 0016 题 读取 txt文件 写入成 xls文件
student.txt{ "1":["张三",150,120,100], "2":["李四",90,99,95], "3":["王五",60,66,68]}city.txt{ "1":"上海", "2":"北京", "3":"成都&quo原创 2018-04-03 17:34:33 · 337 阅读 · 0 评论 -
第 0013 题: 用 Python 写一个爬图片的程序,爬 这个链接里的日本妹子图片 :-) Python3 图片 爬取 下载 到 本地
import requestsimport osfrom bs4 import BeautifulSoup# 获得所有的img对象def get_list_img(webUrl): rq = requests.get(webUrl) # 解析网页 soup = BeautifulSoup(rq.text, "lxml") return soup.sele...原创 2018-03-23 15:07:59 · 810 阅读 · 0 评论 -
第0005题 练习 你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小。
from pathlib import Pathfrom PIL import Imagedef modify_imgsize(fileUrl): p = Path(fileUrl) ImgFileList = list(p.glob('*.jpg')) ImgFileList.extend(list(p.glob('*.png'))) for filena...原创 2018-03-21 17:59:19 · 617 阅读 · 1 评论 -
Python的各种函数工具记录
zip()函数:>>>a = [1,2,3]>>> b = [4,5,6]>>> c = [4,5,6,7,8]>>> zipped =原创 2018-10-09 10:30:13 · 258 阅读 · 0 评论 -
Python 字符串前面加 u r b分别代表什么
1.加u。表示unicode字符串,不仅仅针对中文,可以针对任何字符串,代表对字符串unicode编码。在py文件头加# -- coding: utf-8 --告知该文件以utf-8的编码形式解读处理,后转unicode编码处理。如果运行控制台程序有的时候不会出现正确的中文,这是因为windows下控制台编码是gbk,而文件编码是utf-8,这个时候就需要在字符串前面加上u就行了。 s1 ...原创 2018-10-10 11:13:30 · 642 阅读 · 0 评论 -
pip3 pip 10.0.1 升级到 pip最新版本 19.0.2 版本 问题
You are using pip version 10.0.1, however version 19.0.2 is available.You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.当用pip3 list 显示这行提示我就按照要求输入python -m pip ins...原创 2019-02-13 17:13:01 · 12685 阅读 · 8 评论 -
python字符串操作学习笔记
1.title()方法ada lovelace -> Ada Lovelace 每个单词首字母改为大写。2.upper()方法ada lovelace -> ADA LOVELACE 全部单词都改为大写。3.lower()方法ada LovelacE -> ada lovelace 全部单词改为小写。4.\t制表符5.\n换行符6.剔除字符串开头 末尾...原创 2019-04-23 11:36:06 · 135 阅读 · 0 评论 -
python数字操作学习笔记
1.加减乘除+ - * /2.次方运算32 = 9 33=27 10**6=10000003.表达式运算2+3*4=14 (2+3)*44.空格不影响Python计算表达式的方式5.使用str()避免类型错误age=23 “Happy”+age+“rd Birthday!” 会报错 Python不知道这是数值23还是字符2和3 这个时候就需要用到str...原创 2019-04-30 17:59:32 · 156 阅读 · 0 评论