python 3.x - When creating a text file, should it appear in the project navigator straight away? -


yesterday, files created appeared in project navigator created. today, no changes made code, reason files appear in navigator after execute other parts of code or when terminate code. i'm including of code because it's when user chooses options 3, 4 , 5 files appear in navigator. said, yesterday, files appeared created reason today don't, though have made no changes code.

import sys  def main():      main_menu_choice = input("""please choose following     1. register child.     2. register staff member.     3. children.     4. staff.     5. exit.""")      if main_menu_choice == "1":         child_first_name = input("enter child's first name")            # check no empty string or digit entered         if child_first_name == "" or any(str.isdigit(c) c in  child_first_name):             print("invalid entry.")             main()             return()         else:             child_last_name = input("enter child's last name")          if child_last_name == "" or any(str.isdigit(c) c in  child_last_name):             print("invalid entry.")             main()             return()         else:             child_name = (child_first_name + " " + child_last_name).title()          file = open("children.txt", 'a')         file.write(child_name + "\n")         file.close()         main()         return()      elif main_menu_choice == "2":         staff_first_name = input("enter staff member's first name")          while staff_first_name == "" or any(str.isdigit(c) c in   staff_first_name):             print("sorry didn't catch that\nplease start again.")             main()             return()          else:             staff_last_name = input("enter staff member's last name")          while staff_last_name == "" or any(str.isdigit(c) c in  staff_last_name):             print("sorry didn't catch that\nplease start again.")             main()             return()          staff_name = (staff_first_name + " " + staff_last_name).title()          file = open("staff.txt", 'a')         file.write(staff_name + "\n")         file.close()         main()         return()      elif main_menu_choice == "3":         file = open("children.txt", 'r')         linelist = file.readlines()         linelist.sort()         print("list of children's names in alphabetical order:")         line in linelist:             print(line, end="")         file.close()      elif main_menu_choice == "4":         file = open("staff.txt", 'r')         linelist = file.readlines()         linelist.sort()         print("list of staff member's names in alphabetical order:")         line in linelist:             print(line, end="")         file.close()      elif main_menu_choice == "5":         print("exit.")         sys.exit(0)      else: #if invalid choice made main_menu_choice         print("invalid command, try again.")         main()         return() main() 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -