python - Read in a file, splitting and then writing out desired output -
i new python, , having problems can't seem find answers to. have large file trying read in , split , write out specific information. having trouble read in , split, printing same thing on , on again. blast_output = open("blast.txt").read() line in blast_output: subfields = [item.split('|') item in blast_output.split()] print(str(subfields[0][0]) + "\t" + str(subfields[0][1]) + "\t" + str(subfields[1][3]) + "\t" + str(subfields[2][0])) my input file has many rows this: c0_g1_i1|m.1 gi|74665200|sp|q9hgp0.1|pvg4_schpo 100.00 372 0 0 1 372 1 372 0.0 754 c1002_g1_i1|m.801 gi|1723464|sp|q10302.1|yd49_schpo 100.00 646 0 0 1 646 1 646 0.0 1310 c1003_g1_i1|m.803 gi|74631197|sp|q6bdr8.1|nse4_schpo 100.00 246 0 0 1 246 1 246 1e-179 502 c1004_g1_i1|m.804 gi|74676184|sp...