一个计算机技术爱好者与学习者

0%

pip简介

Pip is a package-management system written in Python and is used to install and manage software packages. The Python Software Foundation recommends using pip for installing Python applications and its dependencies during deployment. Pip connects to an online repository of public packages, called the Python Package Index. Pip can be configured to connect to other package repositories (local or remote), provided that they comply to Python Enhancement Proposal 503.

Most distributions of Python come with pip preinstalled. Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default.

相关文档:

阅读全文 »

为什么需要重试?

典型场景:程序的实现需要调用第三方的API,但是我们并不能保证第三方API一直好用,也不能保证网络一直畅通,所以在调用第三方API时需要加上错误重试。

通用场景:程序的运行不符合预期,我们知道再次调用大概率可以使之符合预期,这时就需要重试。

而重试逻辑我们可以通过循环多次调用实现,也可以使用封装好的重试模块。
本文我们就学习一下Python中比较流行的 retrying 模块,实现一些重试Demo。

阅读全文 »

怎样获取一个脚本的路径?

怎样获取执行脚本的绝对路径?怎样获取执行脚本的父绝对路径?怎样获取入口脚本的绝对路径?。。。
带着这些问题,我们进行一个简单的实验,获知这些问题的答案。

阅读全文 »