2019独角兽企业重金招聘Python工程师标准>>>
1.下载fire模块
pip install fire
2.fire模块的简单使用
#!/usr/bin/python3
import fire
import socket
class Example(object):
def get(self,addr='localhost'): #默认使用localhost作为主机名
s=socket.gethostbyname(addr) #获取ip
print(s)
class F():
f=fire.Fire(Example) #创建一个类使用fire模块
if __name__=='__main__':
e=Example()
3.使用
1.帮助
2.默认
3.获取百度ip
非常简单的一个模块,但我感觉用处还是很大的!