Print in one line after removing previous in Python
I want to print only current index in my Python code.
for my_index in range(100): print(my_index)
This script currently prints like:
>>>python3 main.py 0 1 2 3 4 ...
But I want to print only current my_index
in one line without going to new line (or adding space between) like this:
>>>python3 main.py 0
And then 0
cahnges to 1
like so…
>>>python3 main.py 1
I DON’T want it like this:
>>>python3 main.py 0 1 2 3 4 ...
And Python – Print in one line dynamically – Stack Overflow isn’t answer to my question.
Thanks in advance!