>>> arcpy.ListToolboxes()
[u'3D Analyst Tools(3d)',
u'Analysis Tools(analysis)',
......
u'Toolbox(interactiveTools)']
>>> [i for i in arcpy.ListToolboxes() if i.endswith('analysis)')]
[u'Analysis Tools(analysis)']
So far, everythings looking good.
You may think: Ok, it's little bit complicated. Why don't you use wildcards?
>>> arcpy.ListToolboxes( '*analysis)' )
[]
No string ends with "analysis)"??. Did I missed something?
>>> arcpy.ListToolboxes( '*)' )
[]
UUPS!! No string ends with ")". Should I call my ocoulist ??
>>> ap.ListToolboxes('*analysis')
[u'Analysis Tools(analysis)']
HEURECA!!
Parenthesis are for ArcGIS "signs non gratia": Good enough for printing but not grand enough to receive attention by nobly arcpy-wildcards. But, thanks God!, my beloved core Python is a democratic Python and it's more logical.
This works without the ')'
>>> import arcpy >>> toolList = arcpy.ListToolboxes('*analysis') >>> toolList [u'Analysis Tools(analysis)']
The searchstring doesnt end with parenthesis, the result founded do. IMO it's unlogical.
One supplement to my first comment: The algorythm behind wildcard seems to be an legacy from 9.3.
Like in these old times upper- and lowercase are unpythonical ignored: You are free to write '*ANalySis' or '*analysis' or whatever simular you want to write , if you are looking for '(analysis)' in fact.