Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   CSV input -- Formatted output (http://www.velocityreviews.com/forums/t808137-csv-input-formatted-output.html)

davemullen 01-18-2012 01:52 AM

CSV input -- Formatted output
 
Hi,

I am trying to physically print letters, envelopes, labels and invoices from an ebay csv file. I can print the whole file to my screen but I can't get to the fields individually to format the printed material I listed above. I have tried using lines and csv.reader. Here are some of the fields I have to work with:
SALES RECORD...USER ID...BUYER FULLNAME...BUYER PHONE NUMBER...BUYER EMAIL...BUYER ADDRESS 1....etc..

I have tried many ways, sometimes I got some data to print. After I get selected fields to the screen then I want to print invoices.
Here's the latest failure:

import csv
infile = csv.reader(open("fileexchange_response_123456789.c sv", "rb"))
for 'sales record', 'user id', 'buyer fullname', 'buyer phone number' in reader:
print 'sales record', 'user id', 'buyer fullname', 'buyer phone number'
infile.close()

Any comment would be appreciated.
Thanks, Dave

davemullen 01-18-2012 11:51 PM

Made some progess but I still need HELP
 
I got this to dump out the header record and all the detail records nicely.
I like the Reader because it cleans up the numeric fields.
I still need to test a field or fields and then print fields that I select.
What can I add to accomplish this?
I will keep reading and testing. Thanks, Dave

import csv
rdr= csv.reader( open("fileexchange_response_12458229.csv", "rb" ) )
print 'FILE BEGINS ************************************************'
for row in rdr:
print 'ROW BEGINS'
# I would like to test a field or fields here
# and print multiple fields here
print row
print 'ROW ENDS'
print 'FILE ENDS ************************************************** *'


FILE BEGINS ************************************************
ROW BEGINS
['Sales Record Number', 'User Id', 'Buyer Fullname', 'Buyer Phone Number', 'Buye
r Email', 'Buyer Address 1', 'Buyer Address 2', 'Buyer City', 'Buyer State', 'Bu
yer Zip', 'Buyer Country', 'Order ID', 'Item ID', 'Transaction ID', 'Item Title'
, 'Quantity', 'Sale Price', 'Shipping And Handling', 'Sales Tax', 'Insurance', '
Total Price', 'Payment Method', 'PayPal Transaction ID', 'Sale Date', 'Checkout
Date', 'Paid on Date', 'Shipped on Date', 'Shipping Service', 'Feedback Left', '
Feedback Received', 'Notes to Yourself', 'Custom Label', 'Listed On', 'Sold On',
'Variation Details']
ROW ENDS
ROW BEGINS
real data records not shown


All times are GMT. The time now is 11:10 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.