[issue39240] keyerror in string format

2020-01-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Instead of doing lookups with square brackets, consider using the dict.get() method that returns a default value rather than raising a KeyError for a missing key. composer2[input1] --> composer2.get(input1, 0) -- nosy: +rhettinger _

[issue39240] keyerror in string format

2020-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: When creating a bug report, please show the actual errors that you get. This is not a bug in python. In line 5 you're looking for composer2['third'], so of course you'd need to define it. -- components: -Regular Expressions nosy: +eric.smith resolut

[issue39240] keyerror in string format

2020-01-06 Thread Gerardo
New submission from Gerardo : Hi, i think tha this is a problem, i'm not have mutch experiencing in programming with python. I have added in the file the line that create the problem and a line that make fully functional. Thanks for the time. Gerry -- components: Regular Expressions f