vendredi 20 mai 2016

Text File I/O in python 3.5

Im looking for some help with some python code I'm working on. Here's the pseudo-code; I'll explain below:

while 1:
   num=random.randint(range)
   if num is in list A (path to list):
      restart loop 
   if num is in list B (path to list):
      restart loop
   else:
      function(num)
      if function == TRUE:
         write num to file B
      if function == FALSE
         write num to file A

Essentially I want to generate a random number, check to see if that number is present on any of two text files, if it is not on those files then run the function, if the function resolves true, add that number to one list, if false add it to the other list. I'm rather new to python and python's I/O system; just looking for some help.

thanks




Aucun commentaire:

Enregistrer un commentaire