Rider Dragon
Rider Dragon

Reputation: 11

Sort of like concatenation but not quite

for seqA in poolA:
    print seqA + ":",
    for i in seqA:
        print complements[i],
    print

complements is a dict and poolA is a list.

When I print complements[i] there are spaces in between, how do I remove these spaces?

Upvotes: 1

Views: 74

Answers (2)

Cat Plus Plus
Cat Plus Plus

Reputation: 129904

Well, just don't print them out. Use either from __future__ import print_function and then print(complements[i], end = ''), or sys.stdout.write(complements[i]).

Upvotes: 2

ᅠᅠᅠ
ᅠᅠᅠ

Reputation: 67010

Join the items and print the resulting string.

print ''.join(str(complements[i]) for i in seqA)

Upvotes: 5

Related Questions