Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This is my first question here and I'm sure it's ridiculously simple. But I have Googled and no luck.

I am trying to make a tool in ArcToolbox using a Python script so users can input a street and lot number and it will zoom to the correct location/s in the cadastre. It's working but I have to type the name of the street in upper case in the toolbox and I'd like it work for uppercase or lower.

I assume I should use something like .upper() but I don't know where to put it. I've tried and failed in a few places.

Here's my snippet:

RoadName = "'" + arcpy.GetParameterAsText(0) + "'" 
share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

This should work:

RoadName = "'" + arcpy.GetParameterAsText(0).upper() + "'" 

You can also use the string module:

import string
RoadName = "'" + string.upper(arcpy.GetParameterAsText(0)) + "'"
share|improve this answer
    
Great, I tried them both in my script and either one works perfectly. Many thanks. –  Rosie Oct 16 '12 at 5:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.