Ruby示例:
name = "Spongebob Squarepants"
puts "Who lives in a Pineapple under the sea? \n#{name}."
Run Code Online (Sandbox Code Playgroud)
成功的Python字符串连接对我来说似乎很冗长.
有什么方法可以改变Formatterpython的string.format()用途吗?我有一个自定义的(禁用check_unused_args方法),但这需要我使用formatter.format("text")语法,而不是"text".format()语法,我更喜欢.
我可以以某种方式换掉'默认格式化程序'吗?
注意:这只是一个小项目,我不需要担心搞乱库或任何东西.