[Tutor] Parse text with python

Danny Yoo dyoo at hashcollision.org
Thu Oct 17 23:37:15 CEST 2013


>
>
> The part that always change is the 6666, it can be 1 digit or 4 digits.
> Example: 1.
> The part that never changes is the 1700.
>
>
You most likely need to be more specific with your pattern matching.

Why should we expect no other numbers to be "1700"?   I see several fields
in the form that look like numbers.  For example, you've got "305", "15",
"95".  Do those ever change?  Do they have _any_ possibility to be "1700"
in different instances of input?  And you also have some kind of NAME
field, under which is arbitrary text, it looks like.  Is it at all possible
for some thing to have a name like "J41B 1700 R2D2" or anything like that?

I'm trying to impress the importance of considering the problem not just by
looking at a single example.  Doing so is almost certainly misleading.  You
probably need to consider at least three good examples to generalize a
robust pattern here.

What other examples have you considered?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131017/f9e2e0d3/attachment.html>


More information about the Tutor mailing list