cod*_*eak 1 python file-io alphabet
我有一个近1500行的文件,其中包含")(()(&& ^%&^ a%@%^%*&^"等符号以及整个文件中的一些两个或三个字母.
如何在此类文件中搜索这些字母并在o/p屏幕上显示找到的字母.
可能是最快的方法
import re
with open("giantfile.txt") as infile:
print(re.findall("[A-Za-z]+", infile.read()))
Run Code Online (Sandbox Code Playgroud)