Skip to content

Instantly share code, notes, and snippets.

@Essayoh
Created January 6, 2016 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Essayoh/cd444d750d678c232cf7 to your computer and use it in GitHub Desktop.
Save Essayoh/cd444d750d678c232cf7 to your computer and use it in GitHub Desktop.
import csv
with open("Meteorite_Landings.csv","rb") as source:
rdr= csv.reader(source)
with open("results.csv","wb") as result:
wtr= csv.writer( result )
for r in rdr:
del r[-3:]
del r[:4]
del r[-2]
wtr.writerow( r )
with open("results.csv","rb") as source:
rdr = csv.reader(source)
with open("minimeteor.csv","wb") as result:
wtr = csv.writer(result)
next(rdr, None)
wtr.writerow(['year', 'mass'])
for r in rdr:
str0 = ''.join(r)
str1 = str0[-16:]
str1 = str1[:4]
str2 = str0[:-22]
input = [str1, str2]
wtr.writerow(input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment