First problem solved, with not a really elegant code, but hopefully will get better!
seq=line.split('-') new_s=[] for i in seq: if i!='': new_s.append(i) line='-'.join(new_s)