def show_preview_menu(type): print """ Select From Menu: 1. Show Preview by ID 9. back 0. exit """ selected = raw_input(">>") if selected == '1': print "Enter discovery id:" discovery_id = raw_input(">>") try: file = get_file_by_dicovery_id(discovery_id, type) if file: with open(file, "r") as content: content_split = content.read().splitlines() for count, line in enumerate(content_split): print line if count > 5: break except IOError: print "There is no such dicovery id." main_menu() else: exec_menu(selected, assets_actions)