Fredrik Lundh wrote: > > mal wrote: > > > > But the error message is being produced because the > > > character is NOT a valid format character. One of the > > > reasons for that might be because it's not in the > > > 7-bit range! > > > > True. > > > > I think removing %c completely in that case is the right > > solution (in case you don't want to convert the Unicode char > > using the default encoding to a string first). > > how likely is it that a human programmer will use a bad formatting > character that's not in the ASCII range? Not very likely... the most common case of this error is probably the use of % as percent sign in a formatting string. The next character in those cases is usually whitespace. > -1 on removing it -- people shouldn't have to learn the octal ASCII > table just to be able to fix trivial typos. > > +1 on mapping the character back to a string in the same was as > "repr" -- that is, print ASCII characters as is, map anything else to > an octal escape. > > +0 on leaving it as it is, or mapping non-printables to "?". Agreed. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4