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