diff --git a/remove_space_file.py b/remove_space_file.py new file mode 100644 index 0000000000000000000000000000000000000000..65f6f7bac0d20477972136fafd01ad70618c2b38 --- /dev/null +++ b/remove_space_file.py @@ -0,0 +1,17 @@ +def remove_spaces_file(file)->list: + f = open(file) + text_0 = f.readlines() + string = "" + for line in text_0: + string = string + line + word = string.split(" ") + w = str() + for i in word: + if i != "": + w += i + " " + list(w) + return w + +text ='text.txt' +text =remove_spaces_file(text) +print(text) diff --git a/remove_space_str.py b/remove_space_str.py new file mode 100644 index 0000000000000000000000000000000000000000..70e39c7df3a91e51a9f345bc4ee42198e8a98e02 --- /dev/null +++ b/remove_space_str.py @@ -0,0 +1,10 @@ +def remove_space(stroka:str)->str: + word = stroka.split(" ") + w = str() + for i in word: + if i != "": + w += i+" " + return w + +stroka_0 = "hello word " +print(remove_space(stroka_0)) diff --git a/text.txt b/text.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391