New line when using % formatting in python -


i'm trying print new line while using % formatting. code have:

return '%s\n%s\n%s\nscore: %d' % (seqa, matches, seqb, score) 

but prints:

'attcgt\n||   |\natctat\nscore: 2' 

is there way print new lines using method?

use print instead of return. print evaluates each expression , writes result standard output, whereas return merely echoes returned object (in idle):

>>> seqa = 'attcgt' >>> matches = '||   |' >>> seqb = 'atctat' >>> score = 2 >>> print '%s\n%s\n%s\nscore: %d' % (seqa, matches, seqb, score) attcgt ||   | atctat score: 2 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -