[Tutor] please help
Srinivas Iyyer
srini_iyyer_bio at yahoo.com
Mon Jul 11 03:30:18 CEST 2005
Hello group,
after 4 months my brain became rusty by not solving
problems.
I need some help to regain my basic skills.
my problem:
I have a file that looks like this:
//
AB32456\tTransaction from India
\t 43 \t 34
\t 34 \t 65
\t 12 \t 35
//
AV32567\tTransaction from Singapore
\t 43 \t 34
\t 34 \t 65
\t 12 \t 35
//
AK34678\tTransaction from HongKong
\t 43 \t 34
\t 34 \t 65
\t 12 \t 35
Characterstics:
Every transaction seperated by '//'
Column 1 is container name
Column 2 - Description of transaction and quantities
(in next lines)
What I have to do:
//
AB32456\tTransaction from India
AB32456\t 43 \t 34
AB32456\t 34 \t 65
AB32456\t 12 \t 35
//
AV32567\tTransaction from Singapore
AV32567\t 43 \t 34
AV32567\t 34 \t 65
AV32567\t 12 \t 35
//
AK34678\tTransaction from HongKong
AK34678\t 43 \t 34
AK34678\t 34 \t 65
AK34678\t 12 \t 35
The line that Ive been writing (of course wrong
script):
f1 = open('myfile','r')
stuff = f1.read().split('\n')
for i in stuff:
if i != '//':
trcode = line.split('\t')[0]
trquant = line.split('\t')[1]
print trcode+'\t'+trquant
This is completely garbage and i am getting no where.
Please help me..
thank you
____________________________________________________
Sell on Yahoo! Auctions no fees. Bid on great items.
http://auctions.yahoo.com/
More information about the Tutor
mailing list