现有列表L1=["apple","pear","lemon","peach","grape"],将列表L2=+["watermelon","banana"]追加到列表L1,再将新列表降序排列并输出。
时间: 2023-12-25 22:29:42 浏览: 191
python自动化RobotFramework中Collections列表关键字使用(四)
以下是对你的问题的回答:
```python
L1 = ["apple", "pear", "lemon", "peach", "grape"]
L2 = ["watermelon", "banana"]
L1 += L2
L1.sort(reverse=True)
print(L1) # 输出:['watermelon', 'pear', 'peach', 'lemon', 'grape', 'banana', 'apple']
```
阅读全文