如何将逗号分隔的字符串拆分为字符串列表?

0 python list comma

输入类似于:W,79,V,84,U,63,Y,54,X,91

输出应该是: ['W', '79', 'V', '84' , 'U', '63', 'Y', '54', 'X', '91']

但我的代码充满了逗号。

a1=list(input())
print(a1)
Run Code Online (Sandbox Code Playgroud)

我的输出是 ['W', ',', '7', '9', ',', 'V', ',', '8', '4', ',', 'U', ', ', '6', '3', ',', 'Y', ',', '5', '4', ',', 'X', ',', '9', '1']

怎么去掉逗号?注意:不能使用除 input()、split()、list.append()、len(list)、range()、print() 之外的内置函数]

Mar*_*ces 5

您必须使用input().split(',').

a1=input().split(',')
print(a1)
Run Code Online (Sandbox Code Playgroud)