1
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?

David Heffernan
  • 587,191
  • 41
  • 1,025
  • 1,442

2 Answers2

5

Join the items and print the resulting string.

print ''.join(str(complements[i]) for i in seqA)
Petr Viktorin
  • 62,694
  • 8
  • 78
  • 78
2

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]).

Cat Plus Plus
  • 119,938
  • 26
  • 191
  • 218