How can I call a (string) method assigned to a dict value like this
dict = { True: ''.lower }
I tried
flip = True
print("A".dict[flip])
but then I get:
AttributeError: 'str' object has no attribute 'dict'
How can I call a (string) method assigned to a dict value like this
dict = { True: ''.lower }
I tried
flip = True
print("A".dict[flip])
but then I get:
AttributeError: 'str' object has no attribute 'dict'
d = {True: lambda x: x.lower()}
flip = True
print(d[flip]('A'))
prints
a