Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # In order to get the current time for the filename
- from datetime import datetime
- from pytz import timezone
- # In order to change the name of the file
- from shutil import move
- # Get current time, find your timezone at https://stackoverflow.com/questions/13866926/python-pytz-list-of-timezones
- swissloc = timezone('Europe/Zurich')
- swisstime = datetime.now(swissloc)
- hour_now = swisstime.strftime('%Y-%m-%d_%H-%M-%S')
- move('./test.txt', './test_' + hour_now + '.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement