Need to know if a file as only ASCII charaters

Wolfgang Rohdewald wolfgang at
Wed Jun 17 05:13:11 CEST 2009

On Wednesday, 17. June 2009, Steven D'Aprano wrote:
>         while text:
>             for c in text:
>                 if c not in printable: return False

that is one loop per character.

wouldn't it be faster to apply a regex to text?
something like

while text:
	if'\W',text): return False


More information about the Python-list mailing list