Python3.5 does not support a 'F'prefix

   學習俄羅斯方塊的時候,借鑑別人的代碼,發現遇到這個提示:

Python3.5 does not support a 'F'prefix

經查 f-string 格式化字符串是python 3.6版本新增的格式化字串的方法,比如:

name = nancy

age = 18

print({name} is {age} old)

打印出來就是 nancy is 18 old

上面的 print(f"{chessman.Name}({point.X}, {point.Y})")

可以轉化爲:print("{} ({},{})".format(chessman.Name, point.X, pointY))

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章