1.下载fire模块python
pip install fire
2.fire模块的简单使用socket
#!/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.使用code
1.帮助ip
2.默认get
3.获取百度ippip
很是简单的一个模块,但我感受用处仍是很大的!class