fügt libex01.py hinzu. Enthält read_plaintext

breakmono2
Daniel Tschertkow 5 years ago
parent 723b2bbf66
commit 776eee0092

@ -0,0 +1,14 @@
# file: read_plaintext.py
# module to read plaintext from a file into a string variable.
# Skips non-alphabetic characters and converts the rest to lower case
import string
def read_plaintext(file_path):
txt = ""
with open(file_path, "r") as _file:
for line in _file:
for char in line:
if char in string.ascii_letters:
txt += char
return txt
Loading…
Cancel
Save