top of page

Wild Ivy Retreats Group

Public·14 members
Easton Rivera
Easton Rivera


I have a list of 20 file names, like ['file1.txt', 'file2.txt', ...]. I want to write a Python script to concatenate these files into a new file. I could open each file by f = open(...), read line by line by calling f.readline(), and write each line into that new file. It doesn't seem very "elegant" to me, especially the part where I have to read/write line by line.



For example, consider a directory containing the following files:1.gif, 2.txt, card.gif and a subdirectory subwhich contains only the file 3.txt. glob() will producethe following results. Notice how any leading components of the path arepreserved.

This will copy the files "in1.txt", "in2.txt", and "in3.txt" to a file called "Combined.txt". (The Combined.txt file is automatically created by the Copy command. If Combined.txt previously existed, it is overwritten by the command.) The Copy command supports wildcards, too, so if your file names follow a standard format, you could even do it this way: 041b061a72


Welcome to the group! You can connect with other members, ge...
bottom of page