Quantcast
Channel: Question and Answer » arcmap
Viewing all articles
Browse latest Browse all 248

Lists in field calculator in ArcMap?

$
0
0

Would anyone please indicate to me why this is not working. I am trying to convert all instances of ’02ND’ to ’2ND’ for example where some of the input fields (f1) are already converted and some are not.

In codeblock:

 def calc(f1):
 list=['01ST', '02ND', '03RD', '04TH', '05TH', '06TH', '07TH', '08TH', '09TH']

    for i in list:

        if i in f1:
            f1 = f1.replace('0','')
            return f1.replace('0','')
        else:

            return f1

I simply call the function calc to populate a new field.


Viewing all articles
Browse latest Browse all 248

Trending Articles