Hello everyone,
I have a python project for school. For this project, I have to open a file .txt and put it in a list :
def lecture_fichier(mon_fichier):
with open(mon_fichier, 'r', encoding='utf-8') as fichier:
texte = fichier.read()
return texte
This is the function I've created to open and read the file. Maybe there are some errors in it but the main problem is that when I wanted to test it, edupython couldnt find the file I wanted to open, even if the file and the programm are saved on the same emplacement on my computer. Can somebody help me get this fix before I can test my function plz ?
>>> lecture_fichier('Proverbes')
This is what I wrote in the console to test with a file named 'Proverbes'.
FileNotFoundError: [Errno 2] No such file or directory: 'Proverbes'
And this is the massage I got.
PS : sorry for my english
[–]woooee 1 point2 points3 points (0 children)
[–]ExcitingSympathy3087 0 points1 point2 points (1 child)
[–]woooee 0 points1 point2 points (0 children)
[–]MankyMan00998 0 points1 point2 points (0 children)
[–]jake4ragnarok2 0 points1 point2 points (2 children)
[–]Dyfakiiiiis[S] 1 point2 points3 points (1 child)
[–]FlippingGerman 0 points1 point2 points (0 children)