【问题标题】:Extend() is not working when used inside Print() [duplicate]在 Print() 中使用时,Extend() 不起作用 [重复]
【发布时间】:2020-04-24 23:06:45
【问题描述】:
Marks = [1,2,3,4,5,6]
Students = ["a","b","c","d","e","f"]
print(Students)
  1. Students.extend(分数) 打印(学生)

  2. 打印(Students.extend(Marks))

1 有效,但 2 无效。

【问题讨论】:

  • 因为 extend() 不返回任何东西

标签: python list extends


【解决方案1】:

Python List extend() 方法不返回任何内容,因此没有任何内容可打印

请参阅此处的文档: https://www.tutorialspoint.com/python/list_extend.htm

【讨论】:

    猜你喜欢
    • 2015-03-02
    • 2020-03-31
    • 1970-01-01
    • 2020-08-08
    • 1970-01-01
    • 2014-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多