Skip to content

Instantly share code, notes, and snippets.

@randylubin
Created June 27, 2020 17:55
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 randylubin/084ee083dcb57744ca2d4e3b96193beb to your computer and use it in GitHub Desktop.
Save randylubin/084ee083dcb57744ca2d4e3b96193beb to your computer and use it in GitHub Desktop.
import csv
all_orders = [[
'Name',
'Shipping Tracking'
]]
with open('orders.csv', 'rU') as f:
reader = csv.DictReader(f)
for row in reader:
order = []
# save row
order.append(row['Name'])
order.append(row['Shipping Tracking'])
all_orders.append(order)
# Export
with open("order-tracking.csv", "wb") as sf:
writer = csv.writer(sf)
writer.writerows(all_orders)
print all_orders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment