擅长:python、mysql、java
<p>你需要遍历行中的所有字符,测试它们是元音、辅音还是标点符号。在</p>
<pre><code>for line in fvar:
wordsList = line.split()
numLines += 1
numWords += len(wordsList)
numChars += len(line)
for char in line:
if char in 'aeiou':
numVowl += 1
elif char in 'bcdfghjklmnpqrstvwxyz'
numCons += 1
else:
numPunc += 1
</code></pre>