Skip to content
Snippets Groups Projects
9.py 604 B
Newer Older
first_file_name, second_file_name = input(), input()

with open(first_file_name, "r", encoding="utf-8") as first_file:
    with open(second_file_name, "w", encoding="utf-8") as second_file:
        for line in first_file:
            string = line.rstrip("\n")
            if not string:
                continue
            if "\t" in string:
                while "\t" in string:
                    ind = string.index("\t")
                    string = string[:ind] + string[ind + 1:]
            words = string.split()
            string = " ".join(words)
            second_file.write(string + "\n")