I need to concatenate 8 or 9 fields, using "/" between the text, and no spaces if it is blank, the following code had worked, but has since failed.
def update(a, b, c, d, e, f, g, h):
strArray = []
if a != ' ':
strArray.append(a + "/")
if b != ' ':
strArray.append(b + "/")
if c != ' ':
strArray.append(c + "/")
if d != ' ':
strArray.append(d + "/")
if e != ' ':
strArray.append(e + "/")
if f != ' ':
strArray.append(f + "/")
if g != ' ':
strArray.append(g + "/")
if h != ' ':
strArray.append(h + "/")
str = "".join(strArray)
str = str.strip()
str = str.lstrip("/")
str = str.rstrip("/")
return str
BFS_concat = update(!GDE_01B!, !GDE_02B!, !GDE_03B!, !GDE_04C!, !GDE_05B!, !GDE_07B!, !GDE_08B!, !GDE_09B!)
Any ideas please ?
Cheers
Brad