p = [[10,10,10],[11,11,11]]
for i in range(0,2):
print("progress = ",p[i])
When I print this i get -
progress = [10, 10, 10]
progress = [11, 11, 11]
I want to remove the brackets from the above list
CodePudding user response:
The i values in the for loop are inner lists. To remove the brackets, unpack the list using *. Your code:
p = [[10,10,10],[11,11,11]]
for i in range(0,2):
print("progress = ",*p[i])
CodePudding user response:
Replace p[i]
with
(", ".join([str(x) for x in p[i]]))
CodePudding user response:
You can do this to remove the brackets from the list:
p = [[10,10,10],[11,11,11]]
for i in range(0,2):
print(str(p[i])[1:-1])