• Stars
    star
    102
  • Rank 333,655 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python related technologies used in work: crawler, data analysis, timing tasks, RPC, page parsing, decorator, built-in functions, Python objects, multi-threading, multi-process, asynchronous, redis, mongodb, mysql, openstack, etc.

Python Study

控制台打印乱码: print '你好,世界!'.decode('utf-8')

url = 'http://{0}:{1}/{2}'.format('0.0.0.0', 2375, 'xxx')
url = 'http://{ip}:{port}/{uri}'.format(ip='0.0.0.0', port=2375, uri='xxx')
url = 'http://%s:%d/%s' % ('0.0.0.0', 2375, 'xxx')

Windows Python 依赖库 PythonLibs

  • 1.找到对应的 whl 包下载
  • 2.直接pip install *.whl 或者修改.whl文件为.zip文件,解压缩文件的Python文件夹复制到--python安装目录下的Lib--目录下

Python 中文翻译文档集合

Python 官方文档

Top Python APIs

Python2.7环境变量

假如sys.path不对,则使用Python终端 sys.path = [...]重新设置即可. 默认环境配置如下:

root@node-40:~# python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys 
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']
>>> 
# /etc/profile

export PYTHONPATH=/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0:/usr/lib/pymodules/python2.7
export PATH=$PATH:$PYTHONPATH

Windows环境Python2.7Python3.x 共同使用

  • Python2.7 : $ py -2
  • Python3.x : $ py -3
  • Python2.7 pip : $ py -2 -m pip xxx
  • Python3.x pip : $ pip3 xxx

pycharm

settings

  • enable Code compatibility inspection: settings --> code compatibility inspection

Python内置工具

  • 下载服务器:

    • Python2.x
      • $ python -m SimpleHttpServer 默认端口8000
      • $ py -2 -m SimpleHTTPServer 默认端口8000
      • $ py -2 -m SimpleHTTPServer 9090 指定端口9090
      • 使用代码:
      import SimpleHTTPServer
      
      SimpleHTTPServer.test()
    • Python3.x
      • $ python -m http.server
      • $ py -3 -m http.server
  • Json格式化:$ curl http://localhost:8080/get | python -m json.tool

  • 执行Python代码:$ python -c "print 'hello world!'"

  • 解压zip包:

    • 创建zip包:$ python -m zipfile -c tom.zip tom.txt
    • 解压zip包:$ python -m zipfile -e tom.zip .
    • 查看zip包:$ python -m zipfile -l tom.zip
  • 文件处理:

    import shutil
    
    shutil.copy('C:\Users\Administrator\Desktop\ctools2.rar','q.rar')

关于Python工作中的一些总结性技术

More Repositories

1

flaskapp

Building web project framework with flask. Modular design, supporting data migration, banner, interceptor, exception handling, JSON transformation, swagger, celery, flask configuration expansion, etc.
Python
49
star
2

face-detection-induction-course

Basics of face detection, share detailed steps and complete code in the learning process.
Python
47
star
3

pptp-vpn-server

基于pptp的vpn服务搭建部署脚本
Shell
37
star
4

prometheus-http-client

Prometheus service http client, Use wrapper Automatic selection query mode, there is no need for any implementation
Python
31
star
5

JavaStudy

Java personal learning notes. including: spring,spring-mvc,sping-boot,spring-jpa,ssh,ssm,zookeeper,MQ.
Java
8
star
6

aric-springboot-samples

sprintboot 应用实例,包含durid数据源配置,邮箱配置,异常处理,restfulapi, swagger配置,jsp 和 freemaker,热加载等等
Java
5
star
7

mxnet-spring-samples

Apache MXNet (Incubating) A flexible and efficient library for deep learning for Java samples.
Java
4
star
8

clickhouse-http-client

clickhouse http client.
Python
2
star
9

spring-boot-config-samples

spring-boot-config tests and samples.
Java
2
star
10

linux_service_exporter

prometheus linux service exporter for kubernetes system service process.
Go
2
star
11

OpenStack-zh_CN

OpenStack api 汉化
Python
2
star
12

golang.org

go语言关于golang.org包的常用依赖管理.
Go
2
star
13

tomoncle.github.io

HTML
1
star
14

spring-boot-db-generator

通过数据库生成数据模型及简单xml映射.
1
star
15

emoji-cross-reference

使用git命令提交各种表情,emoji-cross-reference 📕 📗 📘 📙 📓 📚
1
star
16

http-requests

A simple HTTP tool class similar to Python requests.
Java
1
star
17

docker-image-migrate

To cope with the charges for the Docker Hub organization, this is a migration script that can migrate images within the organization to your individual users.
Shell
1
star