<p>我正试图学习python中的函数,我遇到了下面这个问题的死胡同,我必须编写一个函数以获取字符串列表作为输入,删除特殊字符并返回一个包含干净字符串的列表</p>
<p>代码如下所示:</p>
<pre><code>def cleanChar(a):
a=[]
b=[',','?','#','@','$','%','^','&','*','/']
out_list=[]
for x in a:
for y in b:
if y in x:
x=x.replace(y,'')
out_list.append
return out_list
testq = ['#mahesh','%Po*hsi$','Iy&gdj']
test3=cleanChar(testq)
print(test3)
</code></pre>
<blockquote>
<p>I get the out put as an empty list. What am I doing wrong here or what should have been my approach?
Thanks in advance for the help.</p>
</blockquote>