I have a RNA sequence of varying length. Max length of the sequence is 22. Some sequences are shorter. So if a sequence is shorter then add "0" to the end of the line till the length becomes 22.
How to do it in python? this is my input
AAGAUGUGGAAAAAUUGGAAUC
CAGUGGUUUUAUGGUAG
CUCUAGAGGGUUUCUG
UUCAUUCGGC
and my expected ouput should be for example in the last line it does not contain 22 characters so i need to make it 22 by adding zero to it
UUCAUUCGGC000000000000
but as per your commands i am getting out put as AAGAUGUGGAAAAAUU 00000 the addtional characters used for justification came down and not in the same line
rstrip()to strip the newline characters('\n') first:s.rstrip().ljust(22, '0')