[Tutor] How to adjust a text file...
Kent Johnson
kent37 at tds.net
Fri Sep 28 19:26:24 CEST 2007
GTXY20 wrote:
> 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[0]
> 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.
Kent
More information about the Tutor
mailing list