I am trying to get the output of my code formatted in the following way:
Expected:
1 aggc tgtc aatg
13 ctag gcat agaa
25 gtcg tgct gtag
37 agat agtc tgat
49 agtc gc
However, I always get the following output:
1 aggc tgtc aatg13 ctag gcat agaa25 gtcg tgct gtag37 agat agtc tgat49 agtc gc
I'm not sure how to get a new line where it is supposed to be. Can someone help me with this? Thanks a lot!
Here is my code so far that created this output (it is part of a certain function):
to_return = f'{str(index_row): >} {block_row}'
return to_return
CodePudding user response:
Just add the newline character (\n) to the end of your string:
to_return = f'{str(index_row): >} {block_row}\n'
return to_return
CodePudding user response:
Add a new-line character (\n) at the end of the line. Like this:
to_return = f'{str(index_row): >} {block_row}' "\n"
