Skip to content
Advertisement

How do I append the data in text files and combine multiple text files into one text file using python?

My file is like this Heading1, Heading2, Heading3, Heading4, Heading5

Alpha, Beta, Gama, Face, Human

Dog, Camel, Horse, Lion

################# Summary ###############################

JavaScript

I want to make file like this

Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Heading7, Heading8, Heading9, Heading10, Heading11

Alpha, Beta, Gama, Face, Human, V8CA02TB, 8R1, ENVS2F12SLB2, mkern2, 1654774930624, 09 13:42:10 2022

Cat, Dog, Camel, Horse, Lion, V8CA02TB, 8R1, ENVS2F12SLB2, mkern2, 1654774930624, 09 13:42:10 2022

I have to do that on multiple files and then combine all the files in one text file

Any help will be appreciated.

Advertisement

Answer

This will parse your format.

JavaScript

Output:

JavaScript

Combining multiple files is easy, even without Python.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement