M
Murali
In Python, dictionaries can have any hashable value as a string. In
particular I can say
d = {}
d[(1,2)] = "Right"
d["(1,2)"] = "Wrong"
d["key"] = "test"
In order to print "test" using % substitution I can say
print "%(key)s" % d
Is there a way to print "Right" using % substitution?
print "%((1,2))s" % d
gives me "Wrong". Is there any syntax which will allow me to get
"Right" using % substitution?
- Murali
particular I can say
d = {}
d[(1,2)] = "Right"
d["(1,2)"] = "Wrong"
d["key"] = "test"
In order to print "test" using % substitution I can say
print "%(key)s" % d
Is there a way to print "Right" using % substitution?
print "%((1,2))s" % d
gives me "Wrong". Is there any syntax which will allow me to get
"Right" using % substitution?
- Murali