Home > Software engineering >  Im trying to read a saved pickled models that are saved in a folder, I'm looping through the fo
Im trying to read a saved pickled models that are saved in a folder, I'm looping through the fo

Time:01-20

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

CodePudding user response:

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
  • Related