I'm trying variable substitution in a format string that looks like one
that works, but I get an error. What am I doing wrong? tks

x = 40
s = 'John flew to the {0:-^{x}} yesterday'
print(s.format('moon', x))

Error is builtins.KeyError: 'x'

-- 
Jim
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to