标注 | 说明 | 数据类型 |
Input Values | Input values that you want to parse. | Any Value |
Parse type (可选) | Specifies the parse type. Given an input value of C:\ToolData\InputFC.shp:
| String |
派生输出
标注 | 说明 | 数据类型 |
Value |
The Parse Path tool parses the input into its file, path, name, or extension. The output can be used as inline variable in the output name of other tools.
This is a deprecated tool. This functionality has been replaced by the new Parse Path tool.
此工具专用于 ModelBuilder ,而并不在编写 Python 脚本时使用。
Parsing results are controlled by the Parse Type parameter. Example: If the input to the Parse Path tool is C:\ToolData\InputFC.shp, then
Parse Type | Result |
---|---|
File name and extension | InputFC.shp |
File path | C:\ToolData |
File name | InputFC |
File extension | shp |
The same functionality can be accessed in scripting with the Python os module. For example if you pass an input variable:
Input = "C:\ToolData\InputFC.shp", then
import os
os.path.basename(Input)
import os
os.path.dirname(Input)
import os
os.path.basename(Input).rstrip(os.path.splitext(Input)[1])
import os
os.path.splitext(Input)[1].lstrip(".")
The output of Parse Path is a string and cannot be connected directly as an input to the tools such as Create Feature Class in parameters like Feature Class Location which requires a workspace data type as input. Use %Value% inline variable substitution in such cases as shown below:
标注 | 说明 | 数据类型 |
Input Values | Input values that you want to parse. | Any Value |
Parse type (可选) | Specifies the parse type. Given an input value of C:\ToolData\InputFC.shp:
| String |
标注 | 说明 | 数据类型 |
Value |