get the data type of a field in specific

2424
6
04-12-2013 10:06 AM
ElenaG
by
New Contributor
Hello

I need to get the data type of a specific field, example field "NAME", not all fields of the Feature Class as does ListFields or Describe.

Thanks:confused:
Tags (2)
0 Kudos
6 Replies
MichaelVolz
Esteemed Contributor
Just search for that field while looping through the feature classes and then perform a describe on that searched field.
0 Kudos
ElenaG
by
New Contributor
not in time to get the field that I seek

import arcpy
... arcpy.env.workspace = "C:\GISProgramming101\Exercises\Data"
... infc= "Streets.shp"
... fieln="FULL_STREE"
... desc= arcpy.Describe(infc)
... fields = desc.fields
... for field in fields:
...     if field ==fieln:
...         print "type: " % field.type

:confused:
0 Kudos
RobertBorchert
Frequent Contributor III
Look at the features properties in ArcCatalog

It will fully tell you the type of field and various parameters for it.  Such as length of a string field or long or short integer or double precision etc...

Hello

I need to get the data type of a specific field, example field "NAME", not all fields of the Feature Class as does ListFields or Describe.

Thanks:confused:
0 Kudos
ChrisFox3
Occasional Contributor III
ListFields takes a wildcard for the field name, passing in the field name should only return the single field.

import arcpy
arcpy.env.workspace = "C:\GeoSpatialTraining\GISProgramming101\Exercises\Data"
infc= "Streets.shp"
fieln="FULL_STREE"
field = arcpy.ListFields(infc,fieldn)[0]
print field.type
0 Kudos
ElenaG
by
New Contributor
ListFields takes a wildcard for the field name, passing in the field name should only return the single field.

import arcpy
arcpy.env.workspace = "C:\GeoSpatialTraining\GISProgramming101\Exercises\Data"
infc= "Streets.shp"
fieln="FULL_STREE"
field = arcpy.ListFields(infc,fieldn)[0]
print field.type



thank you very much, I started to check on aid but had no idea, thanks 😄
0 Kudos
ElenaG
by
New Contributor
Just search for that field while looping through the feature classes and then perform a describe on that searched field.


thank you very much, I'm starting with arcpy. thanks
0 Kudos