Python list .pop .append .insert

265 阅读1分钟
# 嘉宾名单
name = ['梦儿','星儿','忆秋']

for i in name:
    print(f'Please {i} come to my dinner')
    continue

name_absent = name.pop(1)
print(f"The guests who can't come are {name_absent}")
name.append('秋儿')

for n in name:
    print(f'Please {n} come to my dinner')
    continue
```
```



![1.png](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/ba8acfa604e84573bb4d089a1d4821f6~tplv-k3u1fbpfcp-watermark.image?)