Wow, this is funny! I was going to post a reply on how I use the exportXYv_stats tool and I am seeing a reference to one of my previous posts showing how I do it! Thanks Wayne for the point! I wanted to post some code on here of something I was playing around with yesterday, which is an alternative to using the exportXYv_stats tool. I have found that this actually works much faster than creating a csv file with the exportXYv_stats tool. This method uses a search cursor to grab values and write them out into a new csv file. I tested this and it worked on 9,000 Address points in 3 seconds! Very Cool! Anyways here is an another way to write out attributes to text.
print 'Creating Text File...'
text = open(p.join(ws, "Addresses2.csv"), "w")
srows = arcpy.SearchCursor(address)
for row in srows:
pid = row.getValue('PID')
add = row.getValue('FULL_ADD')
x = row.getValue('POINT_X')
y = row.getValue('POINT_Y')
text.writelines('\n"%s","%s",%s,%s' % (pid,add,x,y))
del row, srows
print 'Text File Created Successfully'
If you would rather make a tab delimited text file you can simply change the commas to '\t'. This is obviously more ideal if you do not have ton of fields you want to export out or if you just want to quickly make stand alone tables using just a few fields from another table. I also realize this is a lot more code than just using Esri's XYv_stats tool, but you have a lot more control over this.One thing you need to pay attention to if you want to use this method is to wrap double quotes around the parameter substitutions for string fields ("%s") and do not put double quotes around numeric fields (%s, x and y fields in my example).