strings

Egor Bolonev ebolonev at mail.ru
Sun Jun 29 19:27:52 EDT 2003


> > 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'
>  >>>

Yes it's weird. The Interactive window of PythonWin shows it correct, but
debugger window is not.:-(







More information about the Python-list mailing list