应为2个参数得到1个参数

2024-05-29 11:21:28 发布

您现在位置:Python中文网/ 问答频道 /正文

python编程新手,我正在尝试使用列表,我有一行代码是holos.insert("holo_enter_info\n"),但出于某种原因,它说它需要2个参数,但它只得到1个。我不知道那意味着什么有人能帮我吗


Tags: 代码info列表参数编程insertenter新手
1条回答
网友
1楼 · 发布于 2024-05-29 11:21:28

programiz

插入()参数

insert()方法采用两个参数:

  • 索引-需要插入元素的索引

  • 元素-这是要插入列表中的元素

Notes:

  • If index is 0, the element is inserted at the beginning of the list.

  • If index is 3, the element is inserted after the 3rd element. Its position will be 4th.

相关问题 更多 >

    热门问题