Suppressing newline writing to file after variable

Noah Hall enalicho at gmail.com
Tue Jun 28 15:27:01 EDT 2011


On Tue, Jun 28, 2011 at 6:32 PM, Ellerbee, Edward <EEllerbee at bbandt.com> wrote:
> Thank you!
>
> That works perfect, I'll have to look into string formatting more.
>
> My next issue to solve I've been researching is:
>
> How to condense a group of numbers to a wildcard list. For example:
>
> 252205
> 252206
> 252208
> 252220
> 252221
> 252222
> 252223
> 919745
> 919725
> 919785
> 704770 thru 704799 (all numbers listed individually in a file)
>
> Condense to:
> 25220[568]
> 25222[0-3] (or 25222[0123] is fine too)
> 9197[248]5
> 7047[0-9][0-9]
>
> Any recommendations on where to start, a method or function to research?

Hm, perhaps re (http://docs.python.org/library/re.html). It depends on
whether it's a standard static set of values you need to compare
against, or a undefined dynamic set.



More information about the Python-list mailing list