Regular expressions

Jussi Piitulainen harvesting at makes.email.invalid
Tue Nov 3 10:12:28 EST 2015


Peter Otten writes:

> If a "line" is defined as a string that ends with a newline
>
> def ends_in_asterisk(line):
>     return False
>
> would also satisfy the requirement. Lies, damned lies, and specs ;)

Even if a "line" is defined as a string that comes from reading
something like a file with default options, a line may end in
an asterisk.

>>> [ line.endswith('*') for line in StringIO('rivi*\nrivi*\nrivi*') ]
[False, False, True]



More information about the Python-list mailing list