给定单链表头结点head和整数val,需删除链表中所有值等于val的节点并返回新头结点,现有Python代码如下,请补全横线处的内容:
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def removeElements(head: ListNode, val: int) -> ListNode:
dummy = ListNode(0, head)
cur = dummy
while cur.next:
if cur.next.val == val:
_________________________
del del_node
else:
cur = cur.next
return dummy.next