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 ...
随机推荐
- Linux function: unshare
When a new process is created with the clone() system call, a set of flags is provided which tells t ...
- mysql中distinct
1.Distinct 位置 单独的distinct只能放在开头,否则报错,语法错误,与其他函数使用时候,没有位置限制如下 Select player_id,count(distinct(task_id ...
- 【转】第七章、Linux 文件与目录管理
原文网址:http://vbird.dic.ksu.edu.tw/linux_basic/0220filemanager.php 第七章.Linux 文件与目录管理 最近升级日期:2009/08/26 ...
- Phonegap项目创建 编译 安装 运行
一.创建 Phonegap项目 1. cd workspace 2.创建phonegap项目 cordova create 目录 识别符 显示名 例如:cordova create hello com ...
- 我的第一个php扩展
一.进入php源码包,找到ext文件夹 cd /owndata/software/php-5.4.13/ext 文件夹下放的都是php的相关扩展模块 二.生成自己的扩展文件夹和相关文件 php支持开发 ...
- Educational Codeforces Round 37-E.Connected Components?题解
一.题目 二.题目链接 http://codeforces.com/contest/920/problem/E 三.题意 给定一个$N$和$M$.$N$表示有$N$个点,$M$表示,在一个$N$个点组 ...
- 生成式对抗网络(GAN)
生成对抗网络(GAN),是深度学习模型之一,2014年lan Goodfellow的开篇之作Generative Adversarial Network, GAN概述 GAN包括两个模型,一个是生成模 ...
- kettle——入门操作-行列转换(行转列,字段拆分)
1.Row Normaliser,将一行多列数据转换为多行一列数据. 输入数据流: 计算器配置如下: 与计算器相连接的excel输出如下: Row Normaliser,设置如下, 与Row No ...
- python值解析excel
原文:http://blog.csdn.net/tomatoandbeef/article/details/52253578 一.安装python和xlrd模块 python下载地址,安装好后要配置环 ...
- cmd变量,参数,for循环,
@echo offrem *****************************************************rem Create By Q_rui CopryRight@_ ...