
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 · 451 阅读 · 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 · 562 阅读 · 0 评论 -
python 安装gevent 问题
pip3 install geventCollecting geventException: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 · 4074 阅读 · 2 评论 -
python去除字符串首尾的空格
strip是trim掉字符串两边的空格。lstrip, trim掉左边的空格rstrip, trim掉右边的空格theString = ' kljll ' print theString.strip()# kljll原创 2018-10-10 11:53:31 · 29849 阅读 · 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 · 1829 阅读 · 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 · 2991 阅读 · 0 评论