I'm re-reading old code of mine and I wonder why I used several times :
file_2_test = urllib.request.urlopen('file://' + file).read()
when (to my mind)
open(file)
would have been sufficient.
I couldn't find explanation anywhere. I suppose at this time I had to do this for a good reason but can't remember why. The only clue I have is that each time, this line followed :
encoding = (chardet.detect(file_2_test))['encoding']
Could this line be a good reason I didn't use open
?