user_image
By  Hello_zhdya    On   2019年3月4日 08:33

item_ram_size = round(v.split()[0]) 这条获取的值类型为“str”round函数不可以对str进行处理,建议改为:item_ram_size = round(float(v.split()[0])) 就不会报错了! 推荐3个获取disk信息的命令: ##获取厂商: [root@python_master pythontest]# dmidecode -s system-manufacturer VMware, Inc. ##获取型号: [root@python_master pythontest]# dmidecode -s system-product-name VMware Virtual Platform ##获取sn: [root@python_master pythontest]# dmidecode -s system-serial-number VMware-56 4d 25 68 5c ee dc fb-a1 5e 77 6a 5f e7 66 60