darrochkaye

User-Defined Variables and Associated Syntax

Discussion created by darrochkaye on Oct 22, 2012
Latest reply on Oct 22, 2012 by m.gasior
Hi folks,

I have written my first ever Python script which amazingly works, however I have hardcoded the workspace into the script as follows:
env.workspace = "E:\MyGDB.gdb\FeatureDataset"


What I am looking to do is set this as a variable which the user will enter upon running the script. I am aware in ModelBuilder you wrap the variable ID in %'s but I am unsure as how to do this in Python.

Also, it would be very useful for my next task if I knew the syntax to add the above to a new output filename, e.g. %Workspace%\NewFeatureClass in ModelBuilder.

Thanks in advance for your help.
DK

Outcomes