Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Im trying to read a saved pickled models that are saved in a folder, I'm looping through the folder but I keep getting an error

p="/Users/rama/Desktop/lowermodels"
lowerCount=0
for i in range(19):
lowermodel[i]= pickle.load(open(‘/Users/rama/Desktop/lowermodels{lowerCount}.sav’, ‘rb’))
lowerCount= lowerCount+1

this is the error i keep getting, there are 19 different files in the folder

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Looks like you forgot to put an f infront of your f-string

p="/Users/rama/Desktop/lowermodels"
lowerCount=0
for i in range(19):
    lowermodel[i]= pickle.load(open(f'/Users/rama/Desktop/lowermodels{lowerCount}.sav', 'rb'))
    lowerCount= lowerCount+1
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading