Splitting device addresses into parts

Fabian Steiner lists at fabis-site.net
Tue Sep 26 15:28:01 EDT 2006


johnzenger at gmail.com wrote:
> This may be a rare case where regular expressions are not a horrible,
> self-defeating idea.  Something like:
> 
> delimiter = re.compile("[:\.]")
> delimiter.split("PCI:2:3.0")
> ...and then ignore the first entry, and map int the rest.
> Alternatively, if the delimiters can really be anything, and if there
> are no numbers in the first space ("PCI"), then maybe this approach:

Thank you, this solution seems to be quite satisfying :-)

Regards,
Fabian Steiner



More information about the Python-list mailing list