我有一个List,x = [“ apple”,“ banana”,“ carrot”,“ cheese”,“ pear”],我将在一行代码中编写代码,该代码在执行后将返回“ apples,bananas,bans,胡萝卜,奶酪和梨”。
非常感谢您的帮助!
最好的答案是来自Yousaf。
x = [“苹果”,“香蕉”,“胡萝卜”,“奶酪”,“梨”]
print(“ \”“ +的'.join(x [:-1])+” s“ +”和“ +(x [4])+” s“ +” \“”)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句