I don't know how to write the result in a text file, can anyone help me?
import arcpy
rows = arcpy.SearchCursor("E:/Arcgis/lx.gdb/WuChangJieDaokou_onlyweight", "", "", "", "VEHICLEID A; TIME A")
currentState = ""
f=open('C:/Users/GWJ/Desktop/111.txt','w')
for row in rows:
currentState = row.VEHICLEID
f.write(row.VEHICLEID,row.NEAR_X,row.NEAR_Y,row.TIME)
Runtime error Traceback (most recent call last): File "", line 7, in TypeError: function takes exactly 1 argument (4 given)
Runtime error Traceback (most recent call last): File "", line 7, in TypeError: expected a character buffer object
arcpy.SearchCursor
. Instead use DataAccess cursors (arcpy.da.SearchCursor
). Old-style cursors are deprecated, slow, and anti-Pythonic. Learn to use DA cursors now. Rows will become lists and life will be wonderful.