On 2013-03-19, Cathy James <nambo...@gmail.com> wrote: > Dear All, > I need some assistance with Python so that values in the "Name" > field e.g. Murray - James - Leo can be labeled as: > > Murray > James > Leo > > with a new line replacing every dash. > > Basically I need the equivalent of this VB in Python: > replace ( [Name] , "-", vbNewLine) > > I tried this but no luck: > > str.[Name].replace("-", "\n") > str.[Name].replace("-", \n) > [Name].replace("-", \n")
str methods return new strings in Python, so you need to bind something to them. I don't know what the VB syntax above means, but if I pretend that your string is bound to 'Name': Name = Name.replace(" - ", "\n") -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list