Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. def delete_func():
  2. shutil.rmtree("Files")
  3. shutil.rmtree("File")
  4.  
  5. def uniquify(v):
  6. def uniquify(path, sep=''):
  7. def name_sequence():
  8. count = IT.count()
  9. yield ''
  10. while True:
  11. yield '{s}{n:d}'.format(s=sep, n=next(count))
  12.  
  13. orig = tempfile._name_sequence
  14. with tempfile._once_lock:
  15. tempfile._name_sequence = name_sequence()
  16. path = os.path.normpath(path)
  17. dirname, basename = os.path.split(path)
  18. filename, ext = os.path.splitext(basename)
  19. fd, filename = tempfile.mkstemp(dir=dirname,
  20. prefix=filename, suffix=ext)
  21. tempfile._name_sequence = orig
  22.  
  23. makeFile(filename,v)
  24. (uniquify('Files/Value.json'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement