Home How can I print literal curly-brace characters in python string and also use .format on it?
Reply: 0

How can I print literal curly-brace characters in python string and also use .format on it?

user189
1#
user189 Published in May 21, 2018, 6:48 pm
x = " \{ Hello \} {0} "
print x.format(42)

gives me : Key Error: Hello\\

I want to print the output: {Hello} 42

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.341267 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO