consider the tab-separated file foo.txt:
chrY    1208806 1208908 +   .
chrY    1212556 1212620 +   .
chrY    1465479 1466558 +   .
The goal is to manipulate foo.txt to obtain result.txt as such:
chrY:1208806-1208908
chrY:1212556-1212620
chrY:1465479-1466558
What I can achieve is only joining by one specific separator not two different ones --> my code:
with open(filename,'r') as f:
    for line in f:
        l = line.split()[0:3]
        result = ':'.join(l)
        print(result)
My outcome:
chrY:1208806:1208908
chrY:1212556:1212620
chrY:1465479:1466558
 
     
    