f-strings giving SyntaxError?

你说的曾经没有我的故事 提交于 2019-11-28 12:18:04

I think you have an old version of python. try upgrading to the latest version of python. F-string literals have been added to python since python 3.6. you can check more about it here

I think this is due to the old version. I have tried in the new version and the executing fine. and the result is as expected.

f-strings were added in python 3.6. In older python versions, an f-string will result in a syntax error.

If you don't want to (or can't) upgrade, see How do I put a variable inside a String in Python? for alternatives to f-strings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!