关于Python version 3.5 does not support a 'F' prefix的问题!

爬取网站图片,保存步骤出错
with open(f'img/{img_name}', 'wb') as f:
        f.write(img_data)
运行出现Python version 3.5 does not support a 'F' prefix 报错
open(f'img 加了f就出错,不加就保存不了图片
完成爬取的图片保存到img文件夹

那就换种写法

# 1
with open('img/' + str(img_name), 'wb') as f:
    f.write(img_data)
# 2
with open('img/{}'.format(img_name), 'wb') as f:
    f.write(img_data)
# 3
with open('img/%s' % img_name, 'wb') as f:
    f.write(img_data)

可任选一种~