0

can someone show me how I can add conditons to my code to if file does not exits, it cannot go further however if file exits then they add can? This is what I have so far?

def students():
  enter = input("Enter text file: ")
  print ("File found") 
  f=open(enter,'a+')
  t=' '.join(f)
  Username = input("Enter Username: ")
  f.write(Username+",")
  password = input("Enter password:")
  f.write(password)
  f.write(t)
  f.write('\n')
  f.close()

0 Answers0