strings

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Sun Jun 29 19:21:44 EDT 2003


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?
> 
> This one isn't work.
> author=f.read(30).replace('\0',' ').rstrip() #from mp3 tag
> 

That is weird. Are you sure? It works on my system:
(BTW: I think you mean \x00 instead of /x00)

 >>> a='Pink Floyd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
 >>> a
'Pink Floyd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
 >>> a.replace('\0',' ').rstrip()
'Pink Floyd'
 >>>

--Irmen


PS have a look at http://id3-py.sourceforge.net/ .... :-)





More information about the Python-list mailing list