with open('file.txt') as f:
while True:
string = f.readline()
if string == '':
break
your_func(string)
with open('your_file.txt') as f:
txt = f.read().split()
for elem in txt:
your_func(elem)
commands = { "Нажми": "python3 /foor/bar/baz" }