1

Here is my code

from datetime import datetime
import pytz

timezones = {
    'GMT': lambda t: datetime.now(pytz.timezone(t)).strftime("%Y-%m-%d - %H:%M:%S")
}

for k, v in timezones:
    print(v(k))
    

What I want is to have a dictionary where the current time is the value for the timezone key.

When I try to do for k, v in timezones: I get: ValueError: too many values to unpack (expected 2)

I assume this is because there are two colons, which python interprets as having three values instead of two.

Any way around this?

Thanks!

Luke
  • 155
  • 1
  • 10

0 Answers0