I have a fasta file with 18 sequences inside. I want to extract the length of each sequence with header using the len function. My file looks like:
>DR-1
ATGTATGAGGGCAAGAAGACGAAGAACATGTTCCTGACCCGGGCCCTGGAGAAGATTCTG
GCCGACAAGGAAGTGAAGAAGGCGCATCACTCCCAGCTGCGCAAAGCGTGCGAGGTGGCC
CTAGAGGAAATAAAAGTTGAAACTGAGAAACAAAGCCCTCCTCATGGAGAAGCAAAAGCT
GGATCAGGCACCCTTCCACCAGTGAAATCAAAGACAAATTTTATTGAAGCAGACAAGTAC
TTTTTACCCTTTGAGTTGGCATGCCAGTCCAAATGTCCCCGCATAGTTAGTACATCTCTA
GATTGTTTGCAGAAACTTATTGCTTATGGGCACTTGACTGGCAGGGCTCCAGATAGTACG
ACACCAGGCAAAAAATTAATTGATAGAATTATTGAAACAATATGTGGCTGCTTCCAAGGT
CCTCAAACAGATGAAGGAGTTCAGTTGCAGATAATAAAGGCTTTACTTACCGCAGTGACA
TCACAACACATAGAAATCCATGAAGGAACTGTGCTGCAAGCTGTGAGGACATGCTACAAT
ATCTATTTAGCCAGCAAAAATCTCATCAATCAGACAACAGCCAAAGCTACTCTTACTCAA
ATGCTGAACGTTATCTTTGCACGCATGGAAAACCAAGCATTACAGGAGGCCAAACAAATG
GAAAGAGAAAGACATCGGCAGCAGCAGCATTTGTTACAGTCTCCAGTAAGCCATCATGAG
CCCGAGTCACCTCATCTTAGATATTTGCCACCTCAGACTGTTGATCATATAAACCAAGAG
CATGAAGGGGATCTTGAGCCCCAAACACATGATGTGGATAAAAGTCTCCAAGATGATACA
GAGCCTGAAAACGGATCTGATATTTCCAGTGCAGAAAATGAACAGACAGAAGCTGATCAG
GCAACTGCAGCTGAAACATTATCTAAAAATGATATCTTGTATGATGGAGACTATGAAGAA
AAGCCACTTGATATTGTCCAGAGCATTGTAGAAGAAATGGTGAACATCATTGTTGGAGAC
ATGGGAGAAGGGATGGCTATCAGTGCAAGTACAGAAGGCAACACTGGAACTGTAGAAGAT
GGTAGTGACAGTGAAAACATCCAAGCAAATGGAATCCCAGGAACACCCATTTCTGTTGCA
TATACACCATCGTTACCTGACGACAGGTTATCTGTCTCCTCCAATGATACTCAGGAATCT
GGAAATTCTTCAGGACCTTCACCTGGTGCTAAGTTTTCCCACATTTTACAAAAGGATGCC
>SK-1
TTTCTAGTGTTCAGGTCATTGTGTAAGCTGTCAATGAAACCACTGTCAGATGGACCACCA
GATCCAAAGTCTCATGAGTTACGGTCCAAGATTCTTTCATTGCAGTTGCTTCTGTCCATT
CTGCAGAATGCAGGACCTGTTTTCAGGACAAATGAGATGTTTATTAATGCTATCAAGCAG
TATCTATGTGTTGCACTCTCAAAAAACGGAGTCTCATCTGTTCCAGAGGTTTTTGAGCTT
TCTCTTTCCATATTTCTTACTTTGTTGTCAAACTTCAAGACACATCTGAAGATGCAAATT
GAGGTATTCTTTAAAGAAATCTTCCTGTACATTTTGGAAACGTCTACAAGCTCATTTGAC
CATAAGTGGATGGTTATTCAGACACTGACAAGGATCTGTGCAGATGCTCAGAGTGTGGTG
GACATTTATGTAAATTATGACTGTGACCTAAATGCAGCAAATATATTTGAAAGACTAGTA
AATGACCTGTCGAAAATTGCCCAAGGAAGGGGCAGCCAAGAACTTGGTATGAGTAATGTT
CAGGAATTGAGCCTGCGAAAAAAGGGGTTAGAATGTTTAGTTTCAATTTTGAAATGTATG
GTTGAATGGAGCAAGGATCAGTATGTGAACCCCAACTCTCAAACTACCCTTGGTCAGGAA
AAACCCTCAGAGCAAGAGATAAGTGAAGTTAAACACCCAGAGACTATAAACAGATATGGA
AGTTTAAACTCCTTAGAATCCACATCATCATCAGGAATTGGCAGCTACAGTACACAGATG
TCTGGCACTGATAATCCAGAACAATTTGAGGTCCTAAAGCAGCAAAAAGAAATAATAGAA
CAAGGGATTGATTTATTTAATAAGAAACCAAAGAGAGGAATACAATACCTCCAAGAACAA
GGGATGCTTGGCACCACACCCGAAGATATAGCTCAGTTCTTACATCAAGAAGAAAGATTA
GACTCTACTCAGGTGGGTGAGTTCCTGGGAGATAATGATAAATTCAATAAAGAAGTCATG
>SC-1
TATGCATATGTAGACCAACATGACTTTTCAGGAAAAGACTTTGTTTCAGCTCTTCGTCTA
TTTCTGGAAGGATTCCGGCTTCCAGGAGAAGCTCAGAAAATTGATCGATTAATGGAAAAA
TTTGCTGCAAGATACCTAGAGTGCAACCAAGGACAAACCCTTTTTGCTAGTGCAGATACT
GCTTATGTTTTGGCCTACTCAATTATCATGTTGACTACAGACCTTCACAGTCCACAGGTT
AAAAACAAAATGACAAAAGAACAGTACATTAAAATGAATCGTGGTATCAATGACAGTAAA
GATCTCCCTGAAGAGTATCTATCAGCCATTTATAACGAAATAGCTGGGAAAAAAATATCA
ATGAAAGAAACAAAAGAACTAACAATCCCTACAAAGTCAACTAAACAGAATGTAGCCAGT
GAAAAGCAAAGACGACTTCTGTATAACTTAGAAATGGAACAGATGGCCAAGACGGCTAAA
GCACTCATGGAAGCTGTGAGCCATGTTCAGGCACCTTTTACAAGTGCAACACACTTGGAG
CACGTGAGGCCGATGTTTAAGTTGGCTTGGACACCTTTTCTGGCTGCATTCAGTGTGGGT
CTCCAAGACTGTGATGATACTGAAGTAGCCTCTCTTTGCCTAGAAGGGATAAGATGTGCT
ATCAGGATTGCATGCATTTTCAGCATTCAGCTGGAAAGAGATGCATATGTCCAAGCACTA
GCCAGATTTACCTTACTTACAGTGAGTTCTGGTATTACTGAAATGAAACAGAAGAATATC
GACACAATAAAAACACTCATCACGGTGGCTCACACTGATGGAAATTATTTAGGAAATTCG
TGGCATGAGATCCTGAAGTGCATCAGTCAGTTAGAGCTGGCACAACTTATAGGAACTGGA
GTGAAGCCTCGGTACATTTCTGGGACTGTGAGAGGCAGAGAAGGGTCTCTCACTGGGACA
AAAGATCAGGCTCCAGATGAATTTGTTGGTCTAGGGCTAGTTGGAGGAAATGTGGACTGG
AAGCAGATAGCCAGTATTCAGGAGTCTATTGGAGAAACCAGCTCTCAAAGTGTGGTAGTT
GCTGTGGATAGAATATTCACCGGATCCACAAGGCTAGATGGAAATGCTATTGTTGATTTT
GTCCGTTGGCTATGTGCTGTGTCTATGGATGAATTGCTTTCTACTACACACCCAAGAATG
TTTAGTCTACAAAAAATAGTAGAAATATCATACTATAACATGGGAAGAATAAGACTGCAG
TGGTCTCGGATTTGGGAAGTTATTGGAGATCATTTTAATAAGGTTGGTTGCAATCCTAAT
GAAGATGTAGCCATATTTGCAGTAGACTCTCTGAGGCAGCTATCAATGAAGTTTTTAGAG
>SC-2
AAAGGAGAGCTTGCAAACTTCAGATTCCAAAAGGATTTCTTACGACCTTTTGAACATATA
ATGAAACGAAACAGGTCTCCAACAATTCGAGATATGGTTGTACGGTGTATAGCACAAATG
GTTAATTCTCAGGCTGCAAATATTCGTTCAGGATGGAAGAACATTTTCTCAGTATTCCAT
CTAGCTGCATCAGACCAAGATGAAAGCATAGTAGAACTTGCATTTCAGACAACAGGGCAC
ATTGTCACTCTTGTATTTGAAAAACACTTTCCGGCCACCATTGATTCTTTCCAGGATGCA
GTGAAGTGTTTGTCTGAATTCGCATGTAATGCAGCTTTCCCAGACACAAGTATGGAAGCA
ATCCGACTTATTCGCCATTGTGCAAAATATGTGTCTGATAGACCGCAGGCTTTCAAGGAG
TACACAAGTGATGACATGAGCGTGGCACCTGAAGACAGGGTGTGGGTGAGAGGGTGGTTC
CCGATCCTCTTTGAGTTGTCTTGTATCATCAATAGATGCAAATTAGATGTAAGAACCAGG
GGCTTAACAGTAATGTTTGAAATAATGAAAACATATGGCCACACTTATGAAAAACATTGG
TGGCAGGACTTATTCAGAATTGTTTTCAGAATCTTTGACAACATGAAATTGCCAGAACAG
CAGACAGAGAAAGCTGAATGGATGACAACAACTTGTAACCATGCCCTTTATGCAATATGT
GATGTATTCACCCAGTATTTAGAAGTTCTCAGCGATGTACTTTTGGATGATATTTTTGCC
CAGCTTTACTGGTGTGTACAACAAGACAATGAGCAGTTAGCACGATCTGGTACAAACTGC
TTAGAAAACGTGGTTATTCTGAATGGTGAAAAGTTTACTCTTGAAATCTGGGATAAAACG
TGTAACTGCACCCTGGATATCTTCAAAACCACAATTCCTCACGCGCTTCTGACTTGGCGT
>TA-1
CCCACCTCTGGCGAGGCCGAACCCCCATCTCCATCAGCTGTGAGTGAAAAGCCGTTGGAT
GCAATATCACAAAAATCTGTAGACATACATGATTCTATTCAACCAAGATCTTCAGATAAC
AGACAGCAAGCACCACTGGTTTCTGTTTCTACTGTGAGTGAAGAAGTTAGCAAAGTGAAA
TCCACAGCAAAATTCCCAGAACAAAAATTGTTTGCTGCCCTGTTGATTAAATGTGTTGTG
CAGCTGGAACTCATCCAGACCATCGACAACATTGTCTTCTTCCCAGCCACAAGCAAGAAG
GAGGATGCAGAGAACTTAGCTGCAGCCCAGAGAGATGCAGTAGACTTCGATGTTCGAGTT
GATACTCAAGACCAAGGAATGTACCGCTTTTTAACATCACAACAACTGTTCAAGCTACTG
GACTGCTTATTAGAGTCGCATAGATTTGCAAAAGCATTTAATTCCAACAATGAACAGAGG
ACTGCTCTGTGGAAAGCAGGCTTCAAAGGCAAGTCCAAGCCCAATCTTCTAAAACAGGAG
ACAAGCAGCCTGGCGTGTGGGCTGCGCATTCTCTTCCGGATGTACATGGACGAGAGCAGA
GTCAGTGCCTGGGAAGAAGTCCAGCAGAGGCTTTTAAACGTCTGCAGGGAAGCGCTGAGC
TACTTCCTCACTCTAACATCCGAAAGTCACCGGGAAGCCTGGACTAACTTACTGTTACTG
TTCCTCACTAAAGTTCTGAAGATCAGTGACAGCAGGTTTAAAGCTCACGCATCATTCTAC
TACCCTCTCTTATGTGAAATTATGCAATTTGACTTGATTCCGGAACTGCGTGCTGTTCTT
AGAAGATTTTTCCTGCGAATTGGAATAGTATTTCAAATATCACAACCACCTGAACAGGAA
CTTGGGATAAACAGGCAATGA
>DR-2
ATGCAGCCACCACCTCAGGCAGTCCCGTCTGGGGTGGCTGGACCACCCCCAGCTGGGAAT
CCTCGGAGCATGTTCTGGGCCAACAGCCCTTACAGGAAGCCAGCCAATAATGCACCAGTG
GCTCCCATAACACGCCCATTGCAGCCAGTAACGGATCCGTTTGCTTTTAATAGACAGACT
CTTCAAAACACACCAGTAGGAAGTTCATCCAAAAGCAGCCTGCCCAATTTGCCTGGCCCA
GCCCTCTCTGTTTTTTCTCAGTGGCCTGGTTTGCCTGTGACTCCCACAAATGCTGGGGAT
AGCTCCACAGGATTGCATGAGCCTCTGTCAGGAACTCTGTCACAGCCTAGAGCAGATGCC
AGTCTATTTCCTCCTGCATCTACCCCTTCTTCACTCCCTGGGCTGGAGGTGAGCAGGAAT
GCTGAGGCTGATCCCAGCTCAGGACATGAAGTCCAGATGCTGCCACATTCAGCTCACTAC
ATTCCAGGAGTGGGTCCTGAGCAGCCTCTCGGGGGCCAAATGAATGACAGTGGGTCCGGG
CCTGACCAACCCATGAATAGGCATGCCCCCCATGATGGTGCCGTGACCCACGCAGCATCT
CCTTTCCTCCCTCAGCCACAGATGCCAGGTCAGTGGGGGCCTGCACAAGGAGGCCCTCAG
CCCTCCTATCAGCATCACTCACCCTACCTGGAGGGACCTGTTCAGAACATGGGGCTCCAG
GCTGCCAGCTTGCCCCATTTTCCCCCTCCATCTAGTCTACACCAGGGACCTGGCCATGAG
TCTCATGCCCCACAAACATTTACTCCAGCATCCTTGGCCAGTGGTGAAGGGAATGAGATA
GTTCACCAGCAAAGTAAAAATCACCCATTGAGTAGCTTCCCCCCTAAACACACTTTTGAG
CAGAATTCCAGAATTGGGAATATGTGGGCAAGCCCAGAGTTGAAGCAGAATCCGGGAGTG
AATAAAGAGCATCTGCTAGACCCTGCCCATGTCAATCCCTTCACTCAGGGAAATAGTCCT
GAAAACCAGGCGCATCATCCCCCAGTGGCAGCAACTAACCATGCCCTGCAAGAAGCAGCC
TCTGGAGCTCTCTCAATGTTTTTTCAAGGGGAAGAGACAGAGAATGAGGAAAATCTCTCA
TCTGAAAAAGCAGGCCTCGATAAGAGATTGAACTTGGATAGCTTTTCTTCTACCTCCAGA
CTGGGCCATCCACCACCACCTGGAGCTAGTGGTGTCTACCAGGCCTTT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GCCAGGCAGCTGTGCGGTCAGAGCAGCTGTGGCTACACCCACCA
CCTCCTAATACTTTTGGCCCAGCACCTCAAGACTTGGCATCCTACTACTATTACAGACCC
CTGTATGATGCCTACCAGTCTCAGTACCCTTCACCGTACCCGTCAGATCCTGGGACAGCC
TCGCTGTACTACCAGGATATGTATGGCCTGTATGAGCCTCGTTACAGACCCTATGACAGC
TCAGCATCTGCTTATGCCGAGAACCACCGCTATTCTGAGCCTGAGCGGCCCAGCTCCCGT
GCAAGTCACTATTCCGACCAGCTTGCTCCCAGGCAAGGATATCCTGAAGGATACTATAAT
TCCAAGAGTGGATGGAGCAGTCACAGTGATTACTATGCAAATTATTACTCTGGCCAGTAT
GATTATGGAGACCCCAGCCGCTGGGATCGTTACTATGGGTCTCGCCTTAGGGATCCTCGC
ACCTGGGACCGGAGGTACTGGTATGACTCTGAACATGACCCATACAGGAAGGACCACTAT
GCTTACAGTGACAGGCCTGAGAAATGTGATGATCACTGGAGGTATGACCCTCGCTTCACT
GGGAGCTTCGACGATGACGCTGAGATCCACAGGGACCCCTATGGAGAAGAAGCAGACAGA
CGCAGCATCCACAGTGAGCACTCGGCACGGAGCCTGCGCAGCACTCACAGTCTGCCCAGC
CGCCGCAGCAGCCTCAGCTCCCATTCACACCAGAGTCAGATTTACAGAAGCCACCATGTG
ACTGGCGGTTCCTTTGAGGCCCCTCATGCCCCAGGCTCATTTCATGGTGATTATGCCTAT
GGCACATATGCCAGCAATTTCAGCGGTGCCCATGGTTTTCCAGAGTACAGCTACCCTGCA
GACACCTCCTGGCCTGCTGTGGAGCAAGTTCCATCAAGACCGACCTCTCCTGAGAAGTTT
...
...
...
...
I want the output to look like :
>DR-1
1260
>SK-1
1020
>SC-1
1380
>SC-2
960
>TA-1
921
>DR-2
2400
TA-2
>1980
...
...
...
...
I am new to learning python for molecular analysis, so am having trouble with the logic and syntax behind it. I'm looking forward to a warm response from you. Thanks again.