I have a set of text files in a folder. I want to read each file, convert the contents of the file to lowercase, remove punctuations and save them all in another directory with the same filenames. How can i do that???
knan
0
Light Poster
Recommended Answers
Jump to PostHere's another bit of code that will give you part of the solution:
import os dirpath = '/the/directory/path' # or maybe r'D:\the\directory\path' for item in os.listdir(dirpath): p = os.path.join(dirpath,item) desc = 'file' if os.path.isdir(p): desc = 'folder' if os.path.islink(p): desc += ' (link)' print("I found a %s: …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.