0

When i have this in python3 it gives me a invalid syntax error, How would i fix this?

    for filename in os.listdir(f'{KFD}/{name}'):
        image = face_recognition.load_image_file(f"{KFD}/{name}/{filename}")
        encoding = face_recognition.face_encodings(image) [0]
        kf.append(encoding)
        kn.append(name)

Here is the error it gives me;

  File "project1.py", line 19
    for filename in os.listdir(f'{KFD}/{name}'):
                                                         ^
SyntaxError: invalid syntax
  • 1
    Is that the full stack trace correctly formatted? Because the `^` seams misplaced to me. Unless Python started hating void spaces since I went to bed. – Torxed May 28 '20 at 07:47
  • 1
    F string requires Python 3.6 or higher. – Barmar May 28 '20 at 07:48

0 Answers0