操作方法
在 ArcGIS Pro 中,有时需要从属性表中的字符串字段的值中移除多余的空格。 这可以使用 strip() Python 函数来实现,该函数可以移除任何字符(包括空格)。 本文介绍了在“计算字段”工具中使用 strip() Python 函数移除空格的工作流。
在本例中,移除了 COUNTY 字段的值中的多余空格以统一格式。
Note: • The strip() function removes all leading and trailing characters mentioned in the argument. If no argument is presented, only spaces are removed. • To remove either leading or trailing spaces, use the lstrip() or rstrip() functions respectively. • This function only works on string and text fields, not integer fields.
!Field Name!.strip()
Note: The Calculate Field tool changes the input data permanently. To enable undo, toggle the Enable Undo option on in the Calculate Field window before running the tool. Or, create a new field and configure the field.
将从 COUNTY 字段的值中移除空格。
文章 ID: 000028712
获取来自 ArcGIS 专家的帮助
下载 Esri 支持应用程序