1. 之前一直用ipconfig來查看ip地址,哈哈哈,如今發現挺好玩html
#獲取本機的IP地址和mac地址 import uuid import socket def get_mac_address(): mac=uuid.UUID(int = uuid.getnode()).hex[-12:] #print(mac) return ":".join([mac[e:e+2] for e in range(0,11,2)]) #range(0,11,2):在[0:11]取值,間隔爲2 def get_ip_address(): host_name = socket.getfqdn(socket.gethostname()) ip_address = socket.gethostbyname(host_name) return host_name, ip_address if __name__ == '__main__': mac_address = get_mac_address() print('the mac address is: '+mac_address) ip_address = get_ip_address() print('the host name is: '+ip_address[0]) print('the ip address is: '+ip_address[1])
2. adb查看手機設備信息,參考:https://blog.csdn.net/weixin_43927138/article/details/90477966,https://www.jianshu.com/p/7c0a6da594c8node
上述方法我試過了,配置好adb以後:socket
# 在命令行:cmd下使用
# 第一次連上設備時,使用:
adb devices
# 能夠顯示設備,以後就不行了,而後再次使用時一直顯示:List of devices attached
# 我的以爲是設備的調試開關出了問題,後來通過測試,確認是調試開關的問題,換了一個調試開關沒問題的機器就能夠了
參考:測試
http://www.javashuo.com/article/p-fkbeurne-d.htmlui
##記錄筆記spa