Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python open directory and read files

import os
for filename in os.listdir(os.getcwd()):
   with open(os.path.join(os.getcwd(), filename), 'r') as f: # open in readonly mode
      # do your stuff
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #open #directory #read #files
ADD COMMENT
Topic
Name
3+2 =