Removing a string from a list

后端 未结 4 826
抹茶落季
抹茶落季 2021-01-16 04:04

I create a list, and I want to remove a string from it.

Ex:

>>> myList = [\'a\', \'b\', \'c\', \'d\']   
>>> myList = myList.remove         


        
4条回答
  •  攒了一身酷
    2021-01-16 04:49

    The remove() function doesn't return anything, it modifies the list in place. If you don't assign it to a variable you will see that myList doesn't contain c anymore.

提交回复
热议问题