How can I write a function that makes an increment name with the incoming files?
def callback(ch,method, properties, body):
Payload = body.decode("utf-8")
Payload = ast.literal_eval(Payload)
with open("received.png", "wb") as f:
f.write(Payload)
print(type(Payload))
print("Data Received : {}".format(Payload))
Here I receive an image.png and name it received.png. I want to write a function that automatically renames the next incoming image something like received_2.png