python
coocoky
记录点点,书写滴滴
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python文件和目录操作
遍历所有文件 def browser(path, images_paths ): #path为需要遍历的路径 if not os.path.isdir(path): #判断path是否为路径 return for root, dirs, list in os.walk(path): for i in list: ...原创 2017-09-19 10:58:51 · 508 阅读 · 0 评论 -
python 错误集合
OSError: raw write() returned invalid length 94 (should have been between 0 and 47) 在vscode实验python程序时, 出现上面错误. 解决方法: 安装win_unicode_console: pip install win_unicode_console 在代码中加入: import win_unicode...原创 2018-10-04 13:52:52 · 639 阅读 · 0 评论 -
python 安装gevent 问题
pip3 install gevent Collecting gevent Exception: Traceback (most recent call last): File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connection.py", line 137, in _new_conn ...原创 2018-10-10 10:36:02 · 4195 阅读 · 2 评论 -
python去除字符串首尾的空格
strip是trim掉字符串两边的空格。 lstrip, trim掉左边的空格 rstrip, trim掉右边的空格 theString = ' kljll ' print theString.strip() # kljll原创 2018-10-10 11:53:31 · 30070 阅读 · 1 评论 -
自动生成和安装requirements.txt依赖
requirements.txt可以通过pip命令自动生成和安装 生成requirements.txt文件 pip freeze > requirements.txt 安装requirements.txt依赖 pip install -r requirements.txt原创 2018-10-10 11:54:25 · 1956 阅读 · 1 评论 -
Python 调试打印变量名
python 在调试过程中需要打印变量名称和打印变量值, 下面代码可以实现: def tiaoshi(name, locals): print(locals) for key in locals: if locals[key] == name: print(key) print(name) input() ...原创 2018-12-11 21:45:56 · 3110 阅读 · 0 评论
分享