Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- directory = os.path.normpath("file path to folder")
- for subdir, dirs, files in os.walk(directory):
- for file in files:
- if file.endswith(".txt"):
- f=open(os.path.join(subdir, file),'r')
- a = f.read()
- print a
- r = requests.post(url1,data=a).content
- file = 'file path to write api response'
- f = open(file, 'a+')
- f.write(r)
- f.close()
Add Comment
Please, Sign In to add comment