你能帮我解决它吗?名称错误: 未定义名称"data1"


def mergeLists(curf, curs):
dummyNode = Node(0)
tail = dummyNode
while True:
if curf is None:
tail.next = curs
break
if curs is None:
tail.next = curf
break
if data1.dat[:2] <= data2.dat[:2]:
if int(data1.dat[:2]) == int(data2.dat[:2]):
sum = int(data1.dat[-2:]) + int(data2.dat[-2:])
data1.dat = data1.dat[:-2] + " " + str(sum)
tail.next = curf
curf = curf.next
else:
tail.next = curs
curs = curs.next
tail = tail.next

您尚未定义或初始化data1和data2变量。尝试初始化它,它会工作的。

相关内容

  • 没有找到相关文章

最新更新