python 命令行工具 fire
简介
A library for automatically generating command line interfaces.
Python Fire is a library for automatically generating command line interfaces (CLIs) with a single line of code.
It will turn any Python module, class, object, function, etc. (any Python component will work!) into a CLI. It’s called Fire because when you call Fire(), it fires off your command.
安装
pip install fire
使用
例子
import fire
class Calculator(object):
"""A simple calculator class."""
def double(self, number):
print '2 *',number,'=',2 * number
def doublekill(self, number, n):
print 'n:',n
print '2 *',number,'=',2 * number
if __name__ == '__main__':
fire.Fire(Calculator)
执行结果
python 命令行工具 fire的更多相关文章
- python制作命令行工具——fire
python制作命令行工具--fire 前言 本篇教程的目的是希望大家可以通读完此篇之后,可以使用python制作一款符合自己需求的linux工具. 本教程使用的是google开源的python第三方 ...
- Python 命令行工具 argparse 模块使用详解
先来介绍一把最基本的用法 import argparse parser = argparse.ArgumentParser() parser.parse_args() 在执行 parse_args() ...
- 让你如绅士般基于描述编写 Python 命令行工具的开源项目:docopt
作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...
- [python] 自动生成命令行工具 - fire 简介
转自 Alan Lee Python 中用于生成命令行接口(Command Line Interfaces, CLIs)的工具已经有一些了,例如已经成为 Python 标准库的 argparse 和第 ...
- 让你如“老”绅士般编写 Python 命令行工具的开源项目:docopt
作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...
- python命令行工具的使用——argparse
argparse是一个常用的库函数,使用它的时候我们在命令行中不仅仅可以运行python文件,更可以零时调整参数,十分方便. 首先,如果你只是希望传一丢丢数据进去,那么只看下面两行就行了 import ...
- Python -- Scrapy 命令行工具(command line tools)
结合scrapy 官方文档,进行学习,并整理了部分自己学习实践的内容 Scrapy是通过 scrapy 命令行工具进行控制的. 这里我们称之为 “Scrapy tool” 以用来和子命令进行区分. 对 ...
- You-Get 视频下载工具 Python命令行下载工具
You-Get 是一个命令行工具, 用来下载各大视频网站的视频, 是我目前知道的命令行下载工具中最好的一个, 之前使用过 youtube-dl, 但是 youtube-dl 吧, 下载好的视频是分段的 ...
- Python 简易web日志查看工具&可改装为命令行工具
Python 简易web日志查看工具&可改装为命令行工具 效果图 原理 利用python的paramiko库模拟ssh登录操作,并执行tail命令 所需库 flask.paramiko.gev ...
随机推荐
- windows mac ssh 出国访问google等系列网站
淘宝买ssh代理 windows:tunnelier mac:issh 浏览器:chrome 插件:switchysharp
- Windows应用程序的VC链接器设置
Windows应用程序的VC链接器设置 /*转载请注明出自 听风独奏 www.GbcDbj.com */ Windows应用程序分为GUI(Graphical User Interface)和CUI( ...
- elasticsearch RESTful
一 .索引(index) 1. 创建索引 (1)第一种方式 PUT twitter { "settings" : { "index" : { "num ...
- (转)C#与Outlook交互收发邮件
本文转载自:http://www.cnblogs.com/Moosdau/archive/2012/03/11/2390729.html .Net对POP3邮件系统已经集成了相应的功能,但是如果是基于 ...
- Java separatorChar 如何在Java里面添加 \
Java手册 separatorChar public static final char separatorChar 与系统有关的默认名称分隔符.此字段被初始化为包含系统属性 file.separa ...
- [原创][C#.Winform 控件]Krypton Suite comments
命名空间:ComponentFactory.Krypton.Toolkit 最新版本:v4.4.0 官网状态:已停用 下载地址1:http://downloads.informer.com/krypt ...
- Go语言面组合式向对象编程基础总结
转自:http://blog.csdn.net/yue7603835/article/details/44282823 Go语言的面向对象编程简单而干净,通过非侵入式接口模型,否定了C/C++ Jav ...
- 031:Cetus sharding
目录 一.主机环境 二.搭建环境 1.准备环境 三.Cetus安装 1.下载包和安装依赖包 2.Cetus安装 1.安装说明 2.安装实施 四.Cetus配置 1.创建和修改配置文件 2.启动cetu ...
- flask 蓝图
转自:http://spacewander.github.io/explore-flask-zh/7-blueprints.html 蓝图 什么是蓝图? 一个蓝图定义了可用于单个应用的视图,模板,静态 ...
- 根据插件Swipe,结合jQuery封装成的新的jQuery插件
swipe支持电脑上的自动滑动,也支持手机端的滑动效果.但是每次调用只能支持一个效果或者说一个页面出现n个这样的效果,我们就得调用n次这个插件. 我使用swipe+jQuery使得swip变得方便使用 ...