-1

I (Python newby) am working with ArcGIS and want to have a list of all its tools with their full descriptions. I already got all tool names, using arcpy.ListTools(). But to get the full description is a problem for me.

To get that description I must use a statement such as this one (for the tool 'EmergingHotSpotAnalysis_stpm'):

arcpy.EmergingHotSpotAnalysis_stpm.__doc__

But how do I put a variable 'toolname' (for all tool names) in this statement?

arcpy.+toolname+.__doc__ does not work.

  • 1
    iterate over the list with a `for` loop: `for tool in tools: tool.__doc__` or what does `ListTools` return? a string? a list of strings? a list of tool objects? – Matiiss Mar 17 '22 at 09:47

1 Answers1

0

I run this:

tools = arcpy.ListTools("*")
for tool in tools:
    usage=arcpy.Usage(tool)

The outcome of the variable usage is for instance:

InterpolateShape_3d(in_surface, in_feature_class, out_feature_class, {sample_distance}, {z_factor}, {method}, {DENSIFY | VERTICES_ONLY}, {pyramid_level_resolution})

With the following statement I can get the description of tool InterpolateShape_3d:

description=arcpy.InterpolateShape_3d.__doc__

This is hardcoded, but I want to do it dynamically. So, from variable usage I extract the part before the (, that's to say InterpolateShape_3d in this example. I put the extract in the variable toolname and then I want to run

description=arcpy.+toolname+.__doc__

where I get stuck.

How to do this dynamically?