lulferts

spooky arcpy wildcards

Discussion created by lulferts on Mar 7, 2016
Latest reply on Mar 7, 2016 by lulferts

>>> 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.

Outcomes