X-Git-Url: https://git.phdru.name/?p=m_lib.git;a=blobdiff_plain;f=m_lib%2Ftty_menu.py;h=897ecc9a8b2764ef02c1db51f4f03bbaef39152d;hp=0c41c86f7bb5f921f3b7bebbee2fb41841f0da67;hb=fb3af94919a9ee18ba1c35f927f19837f057fa1f;hpb=9a523766e02fc3c5d1df4550385a604dca8e6e80 diff --git a/m_lib/tty_menu.py b/m_lib/tty_menu.py index 0c41c86..897ecc9 100755 --- a/m_lib/tty_menu.py +++ b/m_lib/tty_menu.py @@ -2,6 +2,7 @@ """tty menus""" +from __future__ import print_function import string @@ -25,7 +26,7 @@ def vmenu(item_list, prompt, format = "%d. %s"): returns selected number. Returns -1, if user enter non-numeric string. """ for i in range(len(item_list)): - print format % (i, item_list[i]) + print(format % (i, item_list[i])) print result = raw_input(prompt) @@ -40,14 +41,14 @@ def vmenu(item_list, prompt, format = "%d. %s"): def test(): result = hmenu("Select: d)aily, w)eekly, m)onthly, c)ancel: ", "dwmc") - print "Answer is '%s'\n" % result + print("Answer is '%s'\n" % result) os_list = ["DOS", "Windows", "UNIX"] result = vmenu(os_list, "Select OS: ") if 0 <= result < len(os_list): - print "Answer is '%s'\n" % os_list[result] + print("Answer is '%s'\n" % os_list[result]) else: - print "Wrong selection" + print("Wrong selection") if __name__ == "__main__": test()