strings

Peter Hansen peter at engcorp.com
Wed Jul 2 15:06:33 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'
> >  >>>
> 
> Yes it's weird. The Interactive window of PythonWin shows it correct, but
> debugger window is not.:-(

In the debugger window, are you attempting to assign to a local 
variable?  I believe I've encountered problems doing this unless
I prefixed it with "!".  Or was it that I was using one-character
variable names that conflicted with one of Pdb's commands?  I 
forget...

-Peter




More information about the Python-list mailing list