Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Add multiple fields to attribute table by python, with a prompt window for parameters

$
0
0

I know how to add field to arcmap shapefile using Python:

import arcpy
arcpy.env.workspace = "H:pythonexerciseNZL_rdsNZL_roads.shp"
arcpy.AddField_management("NZL_roads", "LENGTH", "TEXT","","","50")

But how to make the python code prompt a window for “field”, “data type” and “length”? Also, what if I want add many fields at once like below:

  • field “SPEEDLIMIT” data type as “num” and length “3″.
  • field “BREADTH” datatype as “num” and length “4″
  • field “LANE” datatype as “num” and length “4″

It should be dynamic, not fixed like my code.


Viewing all articles
Browse latest Browse all 767

Trending Articles