From 361488a7738b7ddde1bdd69eb35a1ca35c8a8ac1 Mon Sep 17 00:00:00 2001 From: XYYR-C <2758975851@qq.com> Date: Sun, 28 Apr 2024 00:01:21 +0800 Subject: [PATCH] =?UTF-8?q?reabse=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 5503356..485aac2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,19 @@ # pythonfire +======= +### 介绍 +这个项目是我们小组学习 Python Fire 的学习报告。Python Fire 是一个开源库,它可以通过单个函数、对象调用生成命令行界面(CLI),无需编写大量的代码。在这个学习报告中,我们将分享对 Python Fire和git的学习心得和使用经验。 +1. 安装: +可打开命令行用pip工具安装 +`pip install fire` +2. 使用方法示例: +``` +import fire +def hello(name="World"): + return f"Hello, {name}!" +if __name__ == "__main__": + fire.Fire(hello) +``` +通过运行以上代码,你可以在命令行中输入 python test.py hello --name="Alice" 来执行 hello 函数并传递参数。 +- 它不局限于对函数的调用,可以创造一个类,进行类函数的执行。具体的应用案例在fire-test中。 +- Python Fire 是一个非常强大和灵活的工具,可以帮助你快速创建命令行界面。