Michele Orrù added the comment: > Attaching patch to trim leading and trailing whitespaces prior to > processing. Note that tests are incorrect: the parsing is of the form %d.%d.%d.%d%c, so the parser should accept trailing spaces. That's the same for ping iirc:
$ ping "192.168.1.1 " PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. --- 192.168.1.1 ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 1007ms $ ping " 192.168.1.1" ping: unknown host 192.168.1.1 I am trying to get out with a simple parser inside the function, probabl y strtol() is the way. Since Python's C API does not provide any sscanf wrapper, I thought about adding a new one. But given that, AFAIS it appears just two times over the entire sourcecode, there is no need IMO for exporting a new one right now. What is your opinion? ---------- nosy: +ezio.melotti _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16201> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com