Print without newline under function doesn't work as it should in Python

前端 未结 3 392
借酒劲吻你
借酒劲吻你 2020-12-20 16:46

I\'m doing a progressbar for my uploading script and therefor i want to print a row of multiple \'#\' but i can\'t get it to work. When i tell Python to not add newline it d

相关标签:
3条回答
  • 2020-12-20 17:10

    You probably need to flush the output buffer after each print invocation. See How to flush output of Python print?

    0 讨论(0)
  • 2020-12-20 17:14

    You can always use the strip() function.

    0 讨论(0)
  • 2020-12-20 17:23

    I tried your code in the IDLE for 2.5. So I had to use print format as - print '#',

    Here is what I get when I execute it - The system prints '#' symbol every second. At the end of the loop I get the prompt back on the IDLE. So it seems to me that it is doing what you expect it to do.

    Which version you are specifically using? Sorry I do not have version 3. So I cannot test it there.

    0 讨论(0)
提交回复
热议问题