I have a python script with some values, which are printed on the terminal for every second. But my script should be always waiting for users input and depend on input change the variables in the script.
Now I have the following code for just printing value every second. I want this script to constantly wait for user input in the background and depends on input change the value of floor.
import argparse
import sys
import time
def createParser ():
parser = argparse.ArgumentParser()
parser.add_argument ('-floor', '--floor')
return parser
parser = createParser()
namespace = parser.parse_args(sys.argv[1:])
def main():
floor = namespace.floor
while True:
print(floor)
time.sleep(1)
main()