回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我正在努力使它,以便我的程序将一个句子分成一个列表</p>
<pre><code>alpha =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
def PARSE(inpu): #Parse and remove symbols
PARSE = list()
d = 0
intv = 0
output = 0
for i in range (len(inpu)):
intv = intv + 1
if inpu[intv] in alpha:
output = output, inpu[intv]
intv = 0
LI1 = 1
LI2 = 1
while len[output] != LI1 - 1:
PARSE.append("")
while not len[output] - 1 < LI1 or not output[LI1] == '':
PARSE[LI2 - 1] = PARSE[LI2] + output[LI1]
LI1 = LI1 + 1
last = last + 1
LI1 = LI1 + 1
LI2 = LI2 + 1
PARSE[last] = PARSE[last] + output[LI1 - 1]
done = 1
</code></pre>
<p>但我有一个错误</p>
<pre class="lang-none prettyprint-override"><code>IndexError: string index out of range
</code></pre>
<p>在</p>
<pre><code>if inpu[intv] in alpha:
</code></pre>
<p>我该怎么解决这个问题?你知道吗</p>