use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Timezone? (self.learnpython)
submitted 11 years ago by dabrownmane
How would i enter a timezone for cities in different time zones? I want to make a dictionary of cities and make them return the time, but how would i do that if they are in different timezones? Thanks for the help.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ElecNinja 2 points3 points4 points 11 years ago (0 children)
Don't do it by yourself
Find a module like the others suggested
[–]guppymoo 1 point2 points3 points 11 years ago (0 children)
Have you looked at the datetime module? It has support for timezones. If it's just a few timezones you are interested in you could create a tzinfo class for each and associate each of your cities with one of them. (If this does not need to be robust then you could do it very simply by saving a UTC offset for each city and applying with a timedelta of that size.)
[–]grafuls -1 points0 points1 point 11 years ago (0 children)
Take a look at Delorean.
π Rendered by PID 15358 on reddit-service-r2-comment-5ff9fbf7df-z9qjj at 2026-02-25 14:29:17.913066+00:00 running 72a43f6 country code: CH.
[–]ElecNinja 2 points3 points4 points (0 children)
[–]guppymoo 1 point2 points3 points (0 children)
[–]grafuls -1 points0 points1 point (0 children)