I want to create a module that checks whether a number is prime or not, and to list all of the primes before it.
The functions in the module would take a bit of time if it had to generate the list of primes every single time it was created.
How do I open a .txt file that is in the same folder as the program is in, then have it access the data from it and create a list based off of that? The .txt file will be saved a list afterwards when the function is completed. I also need a bit of guidance on how to actually save the file in a given location.
Any suggestions or tips would be great. Thanks!
I would pickle a
setobject, you could do this:After you created a pickle file, you could use it like this: