1

I used this piece of code in sublime editor

import glob2
from datetime import datetime

filenames = glob2.glob("*.txt")
with open(datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%f")+".txt", 'w') as file:
    for filename in filenames:       
        with open(filename, "r") as f:
            file.write(f.read() + "\n")

I'm not able to get the output. Can anyone shed some light on it?

Vasilisa
  • 4,604
  • 3
  • 20
  • 25
  • Possible duplicate of [Python concatenate text files](https://stackoverflow.com/questions/13613336/python-concatenate-text-files) – Sreeram TP Feb 04 '19 at 04:35
  • Works for me. What do you mean by 'not able to get the output'? –  Feb 04 '19 at 04:38

0 Answers0