摘要: 参考:https://www.cnblogs.com/c-x-a/p/9333826.html 即直接在f-string中用{}括住变量名即可。 由于f字符串是在运行时进行渲染的,因此可以将任何有效的Python表达式放入其中。所以{}内部是可以执行的表达式。 阅读全文
posted @ 2019-09-16 11:20 虚无真仙 阅读(1143) 评论(1) 推荐(0)
摘要: "{} {}".format("hello", "world") # 不设置指定位置,按默认顺序 "{0} {1}".format("hello", "world") # 设置指定位置 "{1} {0} {1}".format("hello", "world") # 设置指定位置 print("网站名:{name}, 地址 {url}".format(name="菜鸟教程", 阅读全文
posted @ 2019-09-16 11:02 虚无真仙 阅读(223) 评论(0) 推荐(0)