I'm getting the following error, how should I fix it?
KeyError: 'a' Process finished with exit code 1
s = """
a b c {a}
""".format({'a':'123'})
print s
                You need to pass in the arguments by name .format(a=123) or use format_map which expects a dictionary:
s = """
a b c {a}
""".format_map({'a':'123'})
                        Named formatting variables must be passed by name:
>>> s = """
... a b c {a}
... """.format(a=123)
>>> print(s)
a b c 123
If you're providing a dict of data, you can "unpack" the names:
>>> d = {'a': 123}
>>> s = """
... a b c {a}
... """.format(**d)
>>> print(s)
a b c 123
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With