motorcycles = ["honda", "yamaha", "suzuki", "ducati"] print(motorcycles) motorcycles.remove("ducati") print(motorcycles)
输出为:
[‘honda‘, ‘yamaha‘, ‘suzuki‘, ‘ducati‘] [‘honda‘, ‘yamaha‘, ‘suzuki‘]
2、
motorcycles = ["honda", "yamaha", "suzuki", "ducati"] print(motorcycles) too_expensive = "ducati" motorcycles.remove(too_expensive) print(motorcycles) print("\nA " + too_expensive.title() + " is too expenfive for me.")
输出为:
[‘honda‘, ‘yamaha‘, ‘suzuki‘, ‘ducati‘] [‘honda‘, ‘yamaha‘, ‘suzuki‘] A Ducati is too expenfive for me.
原文地址:https://www.cnblogs.com/zhouxiin/p/10729352.html
时间: 2024-10-11 00:41:17