Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import chardet
- import os
- import wave
- import sys
- rootDir = './'
- fileExt = '.py'
- fileCount = 0
- def traversal():
- global rootDir
- global fileCount
- for dirName, subdirList, fileList in os.walk(rootDir):
- # print('Found directory: %s' % dirName)
- for fname in fileList:
- if fname.endswith(fileExt):
- f = open(rootDir + fname, 'rb')
- buf = f.read()
- f.close()
- r = chardet.detect(buf)
- encoding = r['encoding'].lower()
- if encoding.find('utf-8') == -1:
- print("%s \t: %s" % (fname, encoding))
- fileCount = fileCount + 1
- del r
- traversal()
Advertisement