Finding the Python code needed to execute a specific geoprocessing tool is as easy as opening the help information for the tool. Esri has included sample Python code for all the geoprocessing tools in ArcGIS Pro and its extensions.
This includes the proper syntax to use within a script along with a description of the variables that can be used with the tool. Help for a specific tool can be accessed in the Geoprocessing pane when the tool is opened by clicking on the small blue question mark located on the upper right side of the pane, as shown in the following screenshot:
The Syntax page in the help information will show you the proper format for the code along with a description of the possible variables that may be included. The following screenshot shows an example of the syntax for the Union tool from the Esri help:
Help for all tools in ArcGIS...