'How do i keep track of the blocks i generated?

So i've written up a "md5 hash generator":

import time
from datetime import datetime
import random

print("Dash Mining Software")

def miner():
  while True:
    hash = random.getrandbits(128)
    print("Dash > ", datetime.now(), "%032x" % hash)
    time.sleep(1.5)

miner()

and i want before the hash to say block 1 and store it in a var so when ever i start my script it remembers the block in was on and con continues the process.

Can anybody help me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source