日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

文件只能安装一次

發布時間:2023/11/27 生活经验 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 文件只能安装一次 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 def get_mac_address(): 
2     mac=uuid.UUID(int = uuid.getnode()).hex[-12:] 
3     return ":".join([mac[e:e+2] for e in range(0,11,2)])

獲取計算機名字

1 import socket
2 socket.gethostname()

linux下獲取主機外網ip

 1 import socket
 2 import fcntl
 3 import struct
 4 def get_ip_address(ifname):
 5     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 6     return socket.inet_ntoa(fcntl.ioctl(
 7         s.fileno(),
 8         0x8915,  # SIOCGIFADDR
 9         struct.pack('256s', ifname[:15])
10     )[20:24])
11 print get_ip_address('lo')
12 print get_ip_address('eth0')

win linux兼容模式

 1 import re,urllib2
 2 class Getmyip:
 3     def getip(self):
 4         try:
 5             myip = self.visit("http://www.ip138.com/ip2city.asp")
 6         except:
 7             try:
 8                 myip = self.visit("http://www.bliao.com/ip.phtml")
 9             except:
10                 try:
11                     myip = self.visit("http://www.whereismyip.com/")
12                 except:
13                     myip = "So sorry!!!"
14         return myip
15     def visit(self,url):
16         opener = urllib2.urlopen(url)
17         if url == opener.geturl():
18             str = opener.read()
19         return re.search('\d+\.\d+\.\d+\.\d+',str).group(0)
20 getmyip = Getmyip()
21 localip = getmyip.getip()
22 print localip

獲取系統信息

Python里里面有個platform模塊,可以得到操作系統的相關信息
import platform
platform.machine()??? # Returns the machine type, e.g. 'i386'

platform.node()??? # Returns the computer's network name

platform.platform(aliased=0, terse=0)??? # Returns a single string identifying the underlying platform

platform.processor()??? # Returns the (true) processor name

platform.python_branch()??? # Returns a string identifying the Python implementation branch.

platform.python_build()??? # Returns a tuple (buildno, builddate) stating the Python build number and date as strings.
????
platform.python_compiler()??? # Returns a string identifying the compiler used for compiling Python.

platform.python_version()??? # Returns the Python version as string 'major.minor.patchlevel'

platform.release()??? # Returns the system's release, e.g. '2.2.0' or 'NT'

platform.system()??? # Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

platform.uname()??? # Fairly portable uname interface. Returns a tuple of strings (system,node,release,version,machine,processor) identifying the underlying platform.
????????
platform.win32_ver(release='', version='', csd='', ptype='')??? # Get additional version information from the Windows Registry and return a tuple (version,csd,ptype) referring to version number, CSD level and OS type (multi/single processor).

?

?

linux系統下 python獲取 內存、cpu、負載、網絡流量、硬盤等信息

http://blog.csdn.net/huguangshanse00/article/details/17053789

?

http://blog.sina.com.cn/s/blog_62dc8af90102wr1j.html

python在windows下獲取cpu、硬盤、bios、主板序列號

?

轉載于:https://www.cnblogs.com/pyfreshman/p/5128360.html

總結

以上是生活随笔為你收集整理的文件只能安装一次的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。