My ultimate goal is to create mailing labels from selected parcel polygons. using the following code I am attempting to write out to a txt file the selected records. It works but I am having issues with the output it is giving me.
1) before each field that contains a string value it is inserting the letter "u".
2) I want to remove the quotes from each field and the brackets.
3) If there is a better way to do this, please let me know
Here is the code followed by a sample of the output
-----------------------------------------------------
import arcpy
from arcpy import env
try:
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd, "ParcelDF")[0]
Parcels = "parcels"
fc = arcpy.mapping.ListLayers(mxd, Parcels, df)[0]
f = open("Y:\Notification Radius Pkgs\Setup10\Test.txt", 'w')
# Create a search cursor
rows = arcpy.SearchCursor(fc)
# Create a list of fields
fields = arcpy.ListFields(fc, "", "")
# Write the output to a text file
record = [""]
for row in rows:
for field in fields:
if field.type != "Geometry":
#print "%s: Value = %s" % (field.name, row.getValue(field.name))
record.append(row.getValue(field.name))
f.writelines("%s\n" % record)
record = [""]
f.close-------------------------------------------------------------------------
SAMPLE OUTPUT
[' ', 27521, u'24', u'37', u'22', u'01', u'B', u'7', 0, u' ', u' ', 0.59999999999999998]