Richard Jones wrote: > John Machin wrote: > > | >>> int("6A61E3AD") > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > ValueError: invalid literal for int(): 6A61E3AD > > | >>> int("6A61E3AD", 16) > > 1784800173 > > > > What am I missing? > > Ah, thankyou! I, on the other hand, looked at that code several times and > saw nothing ;) > > I've fixed the code and it'll be fixed on the server soon (once apache > restarts itself). >
Hi Richard, might be a good idea to spell out the actual criteria rather than rely on side effects of int -- e.g. if the input is not subject to .strip() somewhere between the keyboard and your code, you could get false positives: | >>> int("1234567 ",16) | 19088743 | >>> int(" 1234567",16) | 19088743 re.match("[A-Fa-f0-9]{8,8}", data.strip()) makes it plain what is intended ... Cheers, John Cheers, John -- http://mail.python.org/mailman/listinfo/python-list