Replace "dash" values in a field with new line- VB equivalent of Python
neilc at norwich.edu
Tue Mar 19 16:52:41 CET 2013
On 2013-03-19, Cathy James <nambo4jb at 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:
> 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")
More information about the Python-list