strings

Ben Finney bignose-hates-spam at and-zip-does-too.com.au
Sun Jun 29 18:56:08 EDT 2003


On Mon, 30 Jun 2003 09:54:24 +1100, Egor Bolonev wrote:
> Hi All!
> 
> I have a
> 'Pink Floyd/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00'
> and I want a
> 'Pink Floyd'
> How can I manage it?

I'm assuming '/x00' (which is nothing but a sequence of four characters
in Python) actually means '\0'.

You probably want to split the string into fields delimited by '\0'.
The first field returned is what you wanted to extract from the string.

    <http://python.org/doc/current/lib/module-string.html#l2h-698>

Otherwise (if you actually want to know the position of the '\0'), you
can find it in the string.

    <http://python.org/doc/current/lib/module-string.html#l2h-691>

-- 
 \      "It takes a big man to cry, but it takes a bigger man to laugh |
  `\                                     at that man."  -- Jack Handey |
_o__)                                                                  |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B




More information about the Python-list mailing list