I want to add a bunch of tags similar to *BTAU1293812 to the end of a bunch of strings (eg ">ASIOHDA87982374:r:23423:2342: 2342 known"

i have :

count = 0
....then i open the file and the handle
for line in fi:
if line[0]==">":
handle.write(line +"*" + "BTAU1293812" +str(count) + "\n")
count+=1

but what happens is it attaches my tag to the start of a new line, wheras i actually want the tag to start the directly after the name.

Any clues how to turn ">YGE:2736:1283712:asjdh"
into ">qwhequ13231:1231:!@312:123*BTAU989"

(the particular letters are irrevelant, i just made them up, the actual names are massively long!)

The line most likely ends with \n, so you have to strip the newline with line.rstrip() before can concatenate.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.