Merge branch 'master' of gitea.sec.tu-bs.de:y0085044/Exercise-01
commit
427d49976f
@ -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…
Reference in New Issue