<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[Jean_821的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/Jean_821</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; Jean_821]]></copyright><item><title><![CDATA[如何用ZipFile.write()压缩打包文件夹]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/104271785</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/104271785</guid><author>Jean_821</author><pubDate>Tue, 11 Feb 2020 23:04:53 +0800</pubDate><description><![CDATA[要用os.walk()遍历文件夹。
这个folder2zip.py程序定义了两个函数：
一个只执行打包压缩的函数，
一个使用时调用的函数，包含执行压缩的函数，同时判断压缩包是否已存在，如果已存在则询问是否继续压缩。
import os
from zipfile import ZipFile

def backupZip(folder):                               ...]]></description><category></category></item><item><title><![CDATA[Python编程快速上手 第八章项目9.4]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/104242868</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/104242868</guid><author>Jean_821</author><pubDate>Mon, 10 Feb 2020 00:31:26 +0800</pubDate><description><![CDATA[书中改名的过程过于冗长，我的是对正则表达式用.sub()的方法改名
import re,os,shutil

pattern = re.compile(r'(\d|\d{2})-(\d|\d{2})-(\d{4})')
for i in os.listdir():
    if pattern.search(i):
        new_name = pattern.sub(r'\2-\1-\3...]]></description><category></category></item><item><title><![CDATA[Python编程快速上手 第八章实践项目 8.9.2答案]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/104216876</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/104216876</guid><author>Jean_821</author><pubDate>Fri, 07 Feb 2020 22:25:27 +0800</pubDate><description><![CDATA[看了一些别人的答案都用到了正则表达式，觉得不需那么复杂，这个题的乐趣之处应该是在看到句子前随意给出几个词，最后拼到句子里有搞笑的效果。
我的代码如下：
import shelve

shelf_file = shelve.open('8_9_2_text')
shelf_file['content'] = 'The %s panda walked to the %s and then %s. An...]]></description><category></category></item><item><title><![CDATA[Python编程快速上手 第七章实践项目 7.18.2答案]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/104183630</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/104183630</guid><author>Jean_821</author><pubDate>Wed, 05 Feb 2020 15:54:32 +0800</pubDate><description><![CDATA[写一个函数，它接受一个字符串，做的事情和strip()字符串方法一样。如果只传入了要去除的字符串，没有其他参数，那么就从该字符串首尾去除空白字符。否则，函数第二个参数指定的字符将从该字符串中去除。
在网上查了两个答案都用到了%不太明白怎么用，而且都是用了re.sub()的函数，如果书后习题用本书没讲的东西来解决就失去了练习的意义了对吧，所以我还是研究了一下用书中教的对表达式用.sub()的方法。
...]]></description><category></category></item><item><title><![CDATA[VScode中统一修改变量名]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/103403259</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/103403259</guid><author>Jean_821</author><pubDate>Thu, 05 Dec 2019 13:50:10 +0800</pubDate><description><![CDATA[实现变量被重新命名时，程序内这个变量都被统一修改。
选中变量名，按F2，修改名称。
如果是第一次可能显示无法修改，然后让安装rope，安装即可。
也可以自己先装好：
pip install rope


...]]></description><category></category></item><item><title><![CDATA[python3.7程序打包封装exe]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/103285620</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/103285620</guid><author>Jean_821</author><pubDate>Wed, 27 Nov 2019 23:42:59 +0800</pubDate><description><![CDATA[用python写了第一个平时实用的小程序，最后在打包上遇到了点困难，开始用的py2exe，运行python appname.py py2exe时报IndexError: tuple index out of range，在网上看到有地方说是不兼容python版本的问题，于是改用pyinstaller。
先安装：
pip install pyinstaller

建一个新文件夹，放入你的程序和想用的...]]></description><category></category></item><item><title><![CDATA[Python编程快速上手 实践项目6.7]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/103199200</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/103199200</guid><author>Jean_821</author><pubDate>Fri, 22 Nov 2019 13:29:34 +0800</pubDate><description><![CDATA[网上答案多用了列表解析，小白还不熟练所以用的普通的for循环，代码也加了注释。
划重点：要建立一个列表，里面存储tableData里每个子列表中最长的字符串长度。
def printTable(tabledata):
    max_lengths = []                #建一个空列表存储每个子列表最长字符串的长度
    for list in tabledata:
     ...]]></description><category></category></item><item><title><![CDATA[Python编程快速上手 实践项目5.6.2]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/103115649</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/103115649</guid><author>Jean_821</author><pubDate>Sun, 17 Nov 2019 23:57:48 +0800</pubDate><description><![CDATA[列表到字典的函数，针对好玩游戏物品清单。
函数返回一个字典，表示更新过的物品清单。
inventory = {'rope':1,'torch':6,'gold coin':42,'dagger':1,'arrow':12}
dragonLoot = ['gold coin','dagger','gold coin','gold coin','ruby','ruby']

def addToInve...]]></description><category></category></item><item><title><![CDATA[《Python从入门到实践》第17章对GitHub最受欢迎的python仓库排名用pygal可视化（python_repos.py）报错原因及解决]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/102860597</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/102860597</guid><author>Jean_821</author><pubDate>Fri, 01 Nov 2019 17:05:04 +0800</pubDate><description><![CDATA[书中第349页运行python_repos.py报如下错误：
AttributeError: 'NoneType' object has no attribute 'decode'

对仓库们进行id和description打印，查看一下哪里出了问题：
import requests

url = 'https://api.github.com/search/repositories?q=lang...]]></description><category></category></item><item><title><![CDATA[怎样用命令行或windows powershell比较两个文件的差异]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/102848174</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/102848174</guid><author>Jean_821</author><pubDate>Thu, 31 Oct 2019 23:40:35 +0800</pubDate><description><![CDATA[练习了一个程序，怎么运行都不对，和书的源代码比对的快瞎了也没找出不一样。
Command Line比较两个文件的不同用diff
diff 1.txt 2.txt
以左右对比的形式列出差异：
sdiff 1.txt 2.txt
那么windows下怎么比较两个文件的不一样呢
$a=Get-Content 1.txt
$b=Get-Content 2.txt
Compare-Object $a $b
...]]></description><category></category></item><item><title><![CDATA[windows python3.7 安装requests包]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/102838123</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/102838123</guid><author>Jean_821</author><pubDate>Thu, 31 Oct 2019 15:17:51 +0800</pubDate><description><![CDATA[前一天晚上用pip install requests在家里的电脑还能秒成功，第二天在学校电脑安就不好使了总是time out。
综合网上的方法，就是先下一个requests包再安装：
下载地址
https://github.com/requests/requests.git 下载zip
解压后的request-master文件夹放到python的根目录下，
在cmd中（用dir和cd）打开requ...]]></description><category></category></item><item><title><![CDATA[VScode每次F5运行都要出现下拉菜单手选Python File]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/102733487</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/102733487</guid><author>Jean_821</author><pubDate>Thu, 24 Oct 2019 22:12:56 +0800</pubDate><description><![CDATA[侧菜单调试button（小虫虫）
绿色播放按钮旁边下拉菜单添加配置
选Python：当前文件

]]></description><category></category></item><item><title><![CDATA[vscode的pytest]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/102673593</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/102673593</guid><author>Jean_821</author><pubDate>Mon, 21 Oct 2019 22:32:29 +0800</pubDate><description><![CDATA[pytest升级
cmd：
pip install --upgrade pytest

vscode
ctrl+shift+P
configure tests 选pytest

]]></description><category></category></item><item><title><![CDATA[windows python3.7安装pygame和matplotlib]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/102672335</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/102672335</guid><author>Jean_821</author><pubDate>Mon, 21 Oct 2019 21:30:05 +0800</pubDate><description><![CDATA[http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
这个网页有不同版本的pygame，但是下载显示资源不在。
唉，想下一个Windows64位的python3.7的pygame太难了…
但是最后居然是一个特别简单的命令就装上了：
安装了python3.7会自动安装pip
win+R进入cmd可以查pip版本：
python -m pip --vers...]]></description><category></category></item><item><title><![CDATA[win10 Internet协议版本4里设置DNS服务器地址]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/101646319</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/101646319</guid><author>Jean_821</author><pubDate>Sat, 28 Sep 2019 23:14:04 +0800</pubDate><description><![CDATA[‘设置’—‘网络和Internet’----‘网络和共享中心’
点连接的网络–‘WLAN状态’—‘属性’----'Internet协议版本4’----‘属性’
‘使用下面的DNS服务器地址’

...]]></description><category></category></item><item><title><![CDATA[vscode用vim插件以及改方向键]]></title><link>https://blog.youkuaiyun.com/Jean_821/article/details/101617995</link><guid>https://blog.youkuaiyun.com/Jean_821/article/details/101617995</guid><author>Jean_821</author><pubDate>Sat, 28 Sep 2019 16:28:51 +0800</pubDate><description><![CDATA[小白需要详细记录一下
安装‘vim’扩展。
使用系统的剪贴板：
“文件”----“首选项”-----“设置”
上方的搜索框搜索：“vim.useSystemClipboard”，调勾。
使用ctrl+c/v复制粘贴：
上方搜索框搜索：“vim.useCtrlKey”，去掉调勾。
Esc退出插入模式（normal mode），此时hjkl是方向键。
按i进入插入模式。
该方向键：
在插入模式中，用s...]]></description><category></category></item></channel></rss>