0

I am trying to insert 2 values into the 'extensionsofArcGIS' variable as you can see below, just not sure how to insert more than one at a time? I have tried a few different variations but still no luck..

extensionsofArcGIS = ['3D Analyst', 'Spatial Analyst', 'Geostatistical Analyst','Network Analyst', 'ArcScan']

extensionsofArcGIS.insert(1,'Terrain Editor')(2, 'Test')

extensionsofArcGIS.sort()

print extensionsofArcGIS
2

To add the values of a list into a Python list, use the extend method.

e.g.

extensionsofArcGIS = ['3D Analyst', 'Spatial Analyst', 'Geostatistical Analyst','Network Analyst', 'ArcScan'] 
extensionsofArcGIS.extend(['Terrain Editor', 'Test'])
extensionsofArcGIS.sort()
print extensionsofArcGIS

Here are a few answers that go into detail on extend: https://stackoverflow.com/questions/252703/what-is-the-difference-between-pythons-list-methods-append-and-extend

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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