String Replacement

John Hunter jdhunter at ace.bsd.uchicago.edu
Sun Aug 3 20:45:26 CEST 2003


>>>>> "Tyler" == Tyler Eaves <tyler at scalegen.com> writes:


    Tyler> str = str.replace("\n", "<br>")

'str' is a built in function

>>> str(1)
'1'

And you will be overriding this functionality if you name something
'str'.  Perfectly legal, but might lead to some hard to diagnose bugs
in the future.

John Hunter






More information about the Python-list mailing list