chunk a text database into N equal blocks and retain header
问题 I have several large (30+ million lines) text databases which I am cleaning up with the following code, I need to split the file into 1 million lines or less and retain the header line. I have looked at chunk and itertools but can't get a clear solution. It is to use in an arcgis model. == updated code as per response from icyrock.com import arcpy, os #fc = arcpy.GetParameter(0) #chunk_size = arcpy.GetParameter(1) # number of records in each dataset fc='input.txt' Name = fc[:fc.rfind('.')] fl