I'm trying to check if output of 'os' contains specific words and execute commands based on the results.
The problem is that the program tries to execute the commands even if output of 'os' does not contain those words.
What is the proper way to write it? These are the clauses that check for it:
elif int(choice0) == 3:
import platform
os = platform.linux_distribution()
if "Fedora" in os:
call(["sudo", "dnf", "install", "android-tools"])
exit()
elif "Mint" or "Ubuntu" or "Debian" in os:
call(["sudo", "apt", "install", "android-tools-adb", "android-tools-fastboot"])
exit()
elif "Manjaro" or "Antergos" or "Arch" in os:
call(["sudo", "pacman", "-S", "android-tools"])
exit()
Thanks everyone for trying to help, my current code looks like this:
import platform
distro = platform.linux_distribution()
if distro in ("Fedora", ):
call(["sudo", "dnf", "install", "android-tools"])
exit()
elif distro in ("Ubuntu" or "Mint" or "Debian"):
call(["sudo", "apt", "install", "android-tools-adb", "android-tools-fastboot"])
exit()
elif distro in ("Arch" or "Antergos" or "Manjaro"):
call(["pacman", "-S", "android-tools"])
exit()
I tried three different solutions and none of them actually worked.