Don't know for sure what is happening, but when I use arcpy.UpdateCursor it only writes some of the lines and not all of the lines.
The code is:
cursor = arcpy.UpdateCursor("FInal1a1.shp")
for row in cursor:
row.setValue("NomArq",n)
cursor.updateRow(row)
with arcpy.da.SearchCursor("Final1a1.shp",['Id','Diametro','NomArq']) as Buscador:
with open(nombarch2,"a+")as c:
for row in Buscador:
for cell in row:
conv= str(cell)
c.write(conv)
c.write(" ")
c.write("\n")
f.close
And the output is something like this: (it's the third row)
2 75 21
2 75 0
3 100 0
3 100 0
3 200 0
2 75 21
2 75 21
3 100 0
3 100 0
3 200 0
2 75 21
2 75 21
3 100 21
3 100 0
3 200 0
2 75 21
2 75 21
3 100 21
3 100 21
3 200 0
2 75 21
2 75 21
3 100 21
3 100 21
3 200 21
2 90 32