[Tutor] How to adjust a text file...
kent37 at tds.net
Fri Sep 28 19:26:24 CEST 2007
> Hi There,
> For some reason I am getting no results and if I alter the code to relect:
> inp = open('input.txt')
> for line in inp:
> fields = line.split(",")
> ProdId = fields
> products = fields[1:]
> for product in products:
> print('%s\t%s\n' % (ProdId, Product))
Names are case-sensitive in Python; product and Product are not the same.
> I am left with an error indicating that product is not defined
In the future when you get an error, please copy and paste the entire
error message, including the traceback, into your email.
Also, please use Reply All to reply to the list.
More information about the Tutor