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
  • 601,492
  • 42
  • 1,072
  • 1,490

2 Answers2

5

Join the items and print the resulting string.

print ''.join(str(complements[i]) for i in seqA)
Petr Viktorin
  • 65,510
  • 9
  • 81
  • 81
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
  • 125,936
  • 27
  • 200
  • 224