ListFields
サマリ
Lists the fields in a feature class, shapefile, or table in a specified dataset. The returned list can be limited with search criteria for name and field type and will contain field objects.
構文
ListFields (dataset, {wild_card}, {field_type})
| パラメータ | 説明 | データ タイプ | 
dataset  | 
 The specified feature class or table whose fields will be returned.  | String | 
wild_card  | 
 ワイルドカードを使用して、返される結果を絞り込むことができます。ワイルドカードを指定しない場合は、すべての値が返されます。 (デフォルト値は None)  | String | 
field_type  | 
 The specified field type to be returned. Valid field types are: 
 (デフォルト値は All)  | String | 
| データ タイプ | 説明 | 
| Field | 
 A list containing Field objects is returned.  | 
コードのサンプル
ListFields example
List field properties.
import arcpy
# For each field in the Hospitals feature class, print 
#  the field name, type, and length.
fieldList = arcpy.ListFields("C:/Data/Municipal.gdb/Hospitals")
for field in fieldList:
    print("{0} is a type of {1} with a length of {2}"
          .format(field.name, field.type, field.length))  
ListFields example 2
Generate a list of field names.
import arcpy fclass = "C:/Data/Municipal.gdb/Hospitals" fieldnames = [f.name for f in arcpy.ListFields(fclass)]
関連項目
7/10/2012