Skip to content

Instantly share code, notes, and snippets.

@Luxato
Created May 1, 2018 19:47
Show Gist options
  • Save Luxato/7930658795b6dbf8be0db600cafbadb1 to your computer and use it in GitHub Desktop.
Save Luxato/7930658795b6dbf8be0db600cafbadb1 to your computer and use it in GitHub Desktop.
Read files in directory with python
import xml.etree.ElementTree as ET
import pickle
import os
from os import listdir, getcwd
from os.path import join
directory = os.fsencode(dir_in_string)
for file in os.listdir(directory):
filename = os.fsdecode(file)
if filename[-3:] == "xml":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment