你这里输入是直接输入一个数组类型,不需要进行eval进行转换,报错TypeError: eval() arg 1 must be a string, bytes or code object
因为eval是把str转为list,dict,tuple
x = eval(input("请输入一个字符串列表:"))
word = input("请输入一个字符,包含三个以上该字符的字符串将被从列表中删除:")
print(x)
print(type(x))
print(word)
for i in x:
if i.count(word) >= 3:
x.remove(i)
print(x)