Python杂项
来源:互联网 发布:淘宝网店如何加盟 编辑:程序博客网 时间:2024/06/08 05:08
git
将dev设为master分支
git checkout devgit merge mastergit branch -d mastergit branch -m dev mastergit push -f origin master
日期相关
datetime.now() #现在的时间
unix时间戳
time.time() #获取时间戳localtime()gmtime() #将时间戳转换为结构体strftime('%Y-%m-%d', value) #将结构体转化为字符串
一些问题
包引入问题
from xxx import * #报错
- http://docs.quantifiedcode.com/python-code-patterns/maintainability/from_module_import_all_used.html
notebook
如何配置远程登录
- http://ipython.org/ipython-doc/dev/notebook/public_server.html#notebook-public-server
- https://zhuanlan.zhihu.com/p/20226040
#启动时的命令修改成如下jupyter notebook --config=/home/azureuser/.ipython/profile_nbserver/ipython_notebook_config.py#后台执行,并重定向日志jupyter notebook --config=/home/azureuser/.ipython/profile_nbserver/ipython_notebook_config.py 2> notebook.log &
简单有用的命令
import pandas as pdimport numpy as npimport matplotlib.pyplot as plt%pylab inline #绘图必用%matplotlib inline
简单的IPython notebook 快捷键
ctrl + enter #运行单元格b #在下面创建新的单元格shift + enter #运行单元格,并创建新的单元格space(空格) #翻页shift + M #和下面的单元格合并ctrl + M H #显示所有的快捷键
其他
vim编辑python
我使用的vim插件是spf13,问题如下
[neocomplete] foldmethod=expr[neocomplete] ^ILast time set by ~/.vim/bundle/python-mode/ftplugin/python/pymode.vim[neocomplete] You should disable it or install FastFold plugin.
解决方案:
- https://github.com/spf13/spf13-vim/issues/924
参考文章
- http://tool.chinaz.com/Tools/unixtime.aspx
- http://www.cnblogs.com/codemo/archive/2012/10/24/UnixTime.html
pyenv
一个关于python版本控制的小工具
安装pyenv
git clone git@github.com:yyuu/pyenv.git ~/.pyenvecho 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrcecho 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrcecho 'eval "$(pyenv init -)"' >> ~/.bashrcexec $SHELL -l
安装python
pyenv install --listpyenv install anaconda2-4.1.0 -vpyenv rehash#查看已安装的python版本pyenv versions#设置全局的python版本pyenv global anaconda2-4.1.0pyenv versionspythonpyenv local#使用pip安装模块时会安装到~/.python/versions/anaconda2-4.1.0下,不会和系统模块冲突
参考文章:http://seisman.info/python-pyenv.html
anaconda
conda
conda list #列出python扩展conda install scikit-learn #安装conda update --helpconda --versionconda update condaconda info -envisconda search scikit-learn #查找一个包
参考文章
- http://www.jianshu.com/p/d2e15200ee9b
scrapy
scrapy startproject project_name #创建scrapy项目scrapy genspider spider_name url #创建spider,和对应urlscrapy shell "http://www.baidu.com/..." #可以在shell中使用selector选择器scrapy <command> -h #命令帮助信息scrapy -h #查看所有可用的命令#全局命令startproject #no,settings #runspidershell #N, fetch #N, scrapy fetch <url>:使用scrapy下载器,下载给定的urlview #N, version#项目命令crawl #y, scrapy crawl <spider>check #Ylist #Y, 列出spideredit #Y,scrapy edit <spider>parsegenspider #ydeploybench
0 0
- Python 杂项
- Python 杂项
- Python杂项
- Python杂项
- Python的杂项
- Python入门基础+杂项笔记
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- 杂项
- shapp——一个计算sha256的命令行小工具的实现
- 简单的输入输出
- Unity3d创建注册登录页面(1)
- PAT甲级1013. Battle Over Cities (25)
- springboot使用问题集合
- Python杂项
- 1. Two Sum
- android 高德地图 和 fresco abi so 库冲突的问题。
- [转]一名3年工作经验的程序员应该具备的技能
- 'system': identifier not found错误的解决办法
- ubuntu下安装gcc-arm-embedded-toolchain
- STL容器之queue
- 我的程序-集成块自动优化设计
- Codeforces 779D 二分求上界 Codeforces Round #402 (Div. 2)