[Python-Dev] Re: string.find() again (was Re: timsort for jython)

Ka-Ping Yee python-dev@zesty.ca
Fri, 9 Aug 2002 14:31:30 -0700 (PDT)


On Fri, 9 Aug 2002, Inyeol Lee wrote:
> To underline strings for viewers like less.
>
> >>> underlined = normal.replace('', '_\b')

That doesn't quite work, since it puts an extra underbar at the end.
But it can be done fairly easily without using replace():

    underlined = ''.join(['_\b' + c for c in normal])


-- ?!ng