diff --git a/src/libex01.py b/src/libex01.py new file mode 100644 index 0000000..97ac0d3 --- /dev/null +++ b/src/libex01.py @@ -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