assert语句的运用 代码 123456 # pop() 函数用于移除列表中的一个元素(默认最后一个元素),并且返回该元素的值。mylist = ['item']assert len(mylist) >= 1print(mylist.pop())assert len(mylist) >= 1 运行结果 12345 itemTraceback (most recent call last): File "E:/PythonProject/more/more_assert.py", line 6, in <module> assert len(mylist) >= 1AssertionError 赞微海报分享
近期评论