Best way to generate random file names in Python

前端 未结 11 2085
囚心锁ツ
囚心锁ツ 2020-12-04 08:48

In Python, what is a good, or the best way to generate some random text to prepend to a file(name) that I\'m saving to a server, just to make sure it does not overwrite. Tha

11条回答
  •  渐次进展
    2020-12-04 09:20

    import uuid
       imageName = '{}{:-%Y%m%d%H%M%S}.jpeg'.format(str(uuid.uuid4().hex), datetime.now())
    

提交回复
热议问题