I am trying to remove extra characters printed out in my print statement from another print statement.
Here is what my code looks like:
print(addedlist) #addedlist = [9,5,1989,1,2,3,4,5,6,7,8,9]
for x in range(0, len(addedlist)):
print('%d->'%addedlist[x],end="")
print('\n')
the output of this looks like this:
[9, 5, 1989, 1, 2, 3, 4, 5, 6, 7, 8, 9]
9->5->1989->1->2->3->4->5->6->7->8->9->
I am trying to remove the last -> characters. I tried doing :
print(addedlist) #addedlist = [9,5,1989,1,2,3,4,5,6,7,8,9]
for x in range(0, len(addedlist)):
print('%d->'%addedlist[x],end="")
print('\b\b\n')
but it didn't work.
How would i go about accomplishing this ?
EDIT:
Just some clarification, I know i can change my original print statement to print it more correctly to avoid trailing -> ... I am after a solution for how to erase trailing '->' this once the mistake has been made