What is Python Snippets?
Snippets code it is a paragraph of code that ArcGIS automatically generates for a specific tool or process. Than you can copy this code, incorporate into your script and make further changes for completing your application.
Why do we use Python Snippets?
Snippets code can help you develop your script faster. You dont need to check other documentation or any API's for using that code. Because ArcGIS with export the code block into an easy understandable code for incorporating it into your code.
How do we use Python Snippets?
This is the most important part of this post. There are two away to use python snippets code in ArcGIS.
1- For any task that we apply there is a geoprocessing result, in this table we can get snippets code.
Steps:
- Apply a testing Geoprocessing Task.
- Click Geoprocessing Menu.
- Click Geoprocessing Result
- Find the latest process that we just executed
- Right click to this task and choose Copy Python Snippets
- open a text editor and paste the code.
2 - Second away has to do with Model Builder. You have to create a model for your tasks and in the end choose File-save as Python file.
By this away ArcGIS will create you a python file with all used parameters and processing.
For more details check this video: