Python:delete number in list -


this question has answer here:

i learn python.i have problem here.it simple code,but don't know why result unexpected.

here code:

a=[1,2,3,4,6,7,'dd','ss','gg','oo',8]  in a:     b in range(10):         if i==b:             a.remove(i)  print 

i want delete number in a. expecting result a=['dd','ss','gg','00'] result :

[2, 4, 7, 'dd', 'ss', 'gg', 'oo'] 

i cannot understand why result this.

can me? thank you!

try remove integer list

      = [x x in if not isinstance(x, int)] 

Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -