-2

I am trying this for loop that prints some output. I am using python 2.7.5

And after every output, there is an extra space printing when I use the , after print() method. How can I stop this?

def printHeader(self, header1, header2):
        # for header1
        first = "|   |      "+constants.ICON_BOX
        header1_count = len(header1)

        available_space_for_first_part = 53 - (len(first) + header1_count)
        print(available_space_for_first_part)

        for i in range(available_space_for_first_part):

            print("."),

The output for this will look like:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

There are additional spaces, how can I get rid of them?

Output I want:

..............................
Jananath Banuka
  • 493
  • 3
  • 11
  • 22
  • This doesn't work in `python 2.7.5` that is why I specifically mentioned the python version – Jananath Banuka Dec 29 '19 at 16:42
  • 1
    The top answer to the linked question describes a way to do this that works in Python pre-2.6 (using `sys.stdout`). – khelwood Dec 29 '19 at 16:46
  • If I had to guess, the downvotes are because this is a very easy question to search for. If you put your exact title that you've written into Google, many existing answers come up. – Carcigenicate Dec 29 '19 at 16:56

1 Answers1

1

you could do

s = ""
for i in range(available_space_for_first_part):
  s += "."
print s
man zet
  • 826
  • 9
  • 26