我正在尝试检测软件版本是否是最新的,并且我正在使用 Python 3.3 中的以下代码来执行此操作:
if str(version) in str(buildno):
print("Your software version is up to date. \n")
else:
print("Your software is out of date. Updating your software. \n")
但是,即使它是最新的,它也会不断更新软件。我还尝试了代码变体:
if str(version) in str(buildno) == True:
print("Your software version is up to date. \n")
else:
print("Your software is out of date. Updating your software. \n")
if os == "Windows":
subprocess.call("windowsUpgrade.sh", shell=True)
这也不起作用。我正在使用的方法是否可行,或者我应该采取另一种方法来解决这个问题?
>>> print(version)
4.3.0-18107
>>> print(buildno)
('4.3.0-18107', 1)
感谢您提供的任何答案。