Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Problem labeling with fields that are null

$
0
0
I am trying to make labels that read:
first name
last name
parcel number

The problem is that there are some parcels that do not have last names and as a result just leaves that line blank. I would like to get rid of this blank line for the parcels without last names. I thought the code below would work but it just makes all the labels.

First name
parcel number

def FindLabel ( [LAST_NAME], [FRST_NAME], [MAP_PARCEL] ):
if [LAST_NAME] != None:
return [FRST_NAME] + '\n' + [MAP_PARCEL]
else:
return [FRST_NAME] + '\n' + [LAST_NAME] + '\n' + [MAP_PARCEL]

I am new to python and any help would be greatly appreciated. Thanks!

Viewing all articles
Browse latest Browse all 2485

Trending Articles