I want to write a script which will do some specific job, each time when the job is done, I want to increase a job_done_count by 1, that is if I run the script 10 times, job_done_count will be 10.
This is how this script looks like,
#!/usr/bin/env python
job_done_count = 0
...
if __name__ == '__main__':
do_the_job()
job_done_count += 1
I kind wonder it works or not. Because, each time I run the script, job_done_count will be set to 0, then 1. It doesn’t remember how many times the job being done at all.
Am I supposed not to put this job_done_count in the script?
Or don’t use pickle and do it in any of the following ways.
By hand
With json
Or with a billion other methods!