Python 3 – List remove() 方法 参数 obj - 要从列表中删除的对象。 返回值 此方法不返回任何值,但从列表中删除给定的对象。 示例 以下示例显示了remove()方法的用法。 #!/usr/bin/python3 list1 = ['physics', 'Biology', 'chemistry', 'maths'] list1.remove('Biology') print ("list now : ", list1) list1.remove('maths') print ("list now : ", list1) PythonCopy 结果 当我们运行上面的程序时,它会产生以下结果 – list now : ['physics', 'chemistry', 'maths'] list now : ['physics', 'chemistry'] PythonCopy