Need help with changing field value from uppercase to capitalize

274
2
Jump to solution
11-01-2021 10:10 AM
PatrickMorgan39339662
New Contributor

The following script is taken to field values from an attribute table and printing a string. My problems is that the first field (SpringName) is all uppercase and I need it to only be capitalized. Any and all help is greatly appreciated 

 

import arcpy
from arcpy import env
env.workspace = "C:/Users/morganp/Documents/NOTES/msu/LM_9/Lab9data/gaswell_L9.gdb"
fc = "Springs"
fields = ["SpringName", "Cnty_name"]
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
         print(u'{0}Spring is located in {1} County'.format(row[0], row[1]))

0 Kudos
1 Solution

Accepted Solutions
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Try row[0].title() In your format line.

View solution in original post

2 Replies
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Try row[0].title() In your format line.

PatrickMorgan39339662
New Contributor

Thank you very much, that fixed it

 

0 Kudos