执行以下Python代码,最终的输出结果是?
my_str = "apple,banana,orange"
# 步骤1:将字符串按逗号分割为列表
fruit_list = my_str.split(",")
# 步骤2:将列表用竖线|拼接为新字符串
new_str = "|".join(fruit_list)
# 步骤3:将新字符串前7位转为列表
res = list(new_str[:7])
print(res)
正在加载题目数据…
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析