this is an iteresting code i 've found from (http://gis.stackexchange.com/questions/149240/creating-shp-from-txt-files-using-arcpy?noredirect=1#c... ) but for some reason is not working for my data. I am posting it here:
import arcpy, os
# Read txt file
tmp = [line.split() for line in open(r'C:\temp\txtfile.txt')]
"""
Clean txt file and prepare for Insert Cursor
Needs to be in the following format for this example:
[('60.9090909091', ('347172.2', '4269952.7')),
('85.7334909091', ('337172.8', '4278952.4')),
('123.909673091', ('344572.3', '4547952.2')),
('456.467809091', ('347532.8', '8777952.8'))]
"""
row_values = []
for t in tmp:
row_values.append((float(t[3]), (float(t[1]), float(t[2]))))
# Define the shapefile
shp = r'C:\temp\points.shp'
# Define spatial reference and create shapefile. Factory code for NAD83 UTM 15N is used here
sr = arcpy.SpatialReference(26915)
arcpy.CreateFeatureclass_management (out_path = os.path.dirname(shp), out_name = os.path.basename(shp), geometry_type = "POINT", spatial_reference = sr)
arcpy.AddField_management(shp, "Field1", "DOUBLE")
# Use InsertCursor to update rows
cursor = arcpy.da.InsertCursor(shp, ['Field1','SHAPE@XY'])
for row in row_values:
cursor.insertRow(row)
# Clean up
del cursor