How can I run python in a given timezone (change timezone from outside)?
我正试着在不同的时区里盘算。如何在给定时区(覆盖系统的时区)中运行python?
您可以使用
1 2 3 4 | $ python -c 'import time; print(time.tzname)' ('GMT', 'BST') $ TZ='Europe/Stockholm' python -c 'import time; print(time.tzname)' ('CET', 'CEST') |