Python - make string equal length -


i have rna sequence of varying length. max length of sequence 22. sequences shorter. if sequence shorter add "0" end of line till length becomes 22.

how in python? input

aagauguggaaaaauuggaauc

cagugguuuuaugguag

cucuagaggguuucug

uucauucggc

and expected ouput should example in last line not contain 22 characters need make 22 adding 0

uucauucggc000000000000

but per commands getting out put aagauguggaaaaauu 00000 addtional characters used justification came down , not in same line

use str.ljust method:

>>> s = 'foobar' >>> s.ljust(22, '0') 'foobar0000000000000000' 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -