fiendniu

add elements in a list to a column in a existing table

Discussion created by fiendniu on Mar 5, 2012
Latest reply on Mar 5, 2012 by Morag.Hawkins
Hi, All

I try to add elements from a list to a column/field in an existing table by using code:
    arcpy.AddField_management(LNFeature,"CorrectedBea","DOUBLE")

    element = 0     
    def addtofield(value):
        global item, element
        for element in range(0, len(Blst)-1):
            item = float(Blst[element])
        return item
        
    expression = "addtofield(record)"
    arcpy.CalculateField_management(LNFeature,"CorrectedBea", expression,"PYTHON")



The list is like: Blst=[
84.6298001981,
108.189828096,
47.9148488979,
41.3080129664,
44.1700416951,
44.0527014451,
42.0270603831,
36.6648211624,
317.234023933,
320.48601494,
36.6090470941,
38.5046268785,
38.2021166809,
216.954295698]


My Output is so wired  as shown in attachement. Is there anyone can help to fix it, please?
Thanks alot

Attachments

Outcomes