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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -