
| Current Path : /usr/local/lib/python3.8/dist-packages/pdf/string/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //usr/local/lib/python3.8/dist-packages/pdf/string/get_alphabetic_ratio.py |
def get_alphabetic_ratio(string): """ gives the ratio of alphabetic characters to the rest :type string: str :rtype: float or NoneType """ length = len(string) if length == 0: return None else: return sum([1 for character in string if character.isalpha()]) / length