uptoten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
uptoten.append(11)
print("This is the list after appending the number 11:", uptoten,"\n")
不一样。
print("This is the list after appending the number 11:", uptoten,"\n") 会比不加"\n"多输出一行空行,这样使得结果更加清晰。
楼上说第三个参数默认是“\n”指的是end关键字参数,但这个关键字不可省略
如果代码是 print("This is the list after appending the number 11:", uptoten,end="\n"),则写不写都一样,但是没有end这个关键字,代码会认为“\n”是要输出的字符串的一部分,所以会在末尾再输出一个“回车”,也就是空行。
确实是一样的,"\n"可以不写,因为print函数第三个参数默认值就是"\n",写不写都是一样的