A
A
Asya2020-09-10 15:50:11
Python
Asya, 2020-09-10 15:50:11

How to merge 2 text files in python?

file1.txt

some text
        with tabs here

file2.txt
and
              here


how to make
file3.txt
some text
        with tabs here
        and
              here


to save the tabulation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-09-10
@asyaevloeva

open("file3.txt","w").write(open("file1.txt","r").read() + open("file2.txt","r").read())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question