三重引用字符串的串联

Ped*_*ian 2 python concatenation syntax-error string-interpolation

我目前正在尝试使用变量在三引号字符串中连接.最好的方法是什么?

print('''
Points left to spend: ''' + str(pointsLeft) + '''
''' + str(attrChoice) + ':\t' + '''[''' + str(charAttr[attrChoice]) + ''']
To reduce the number of points spent on this skill, simply enter a negative number.
'''
)
Run Code Online (Sandbox Code Playgroud)

我得到的错误消息是:关键字不能是表达式.任何人都可以解释这意味着什么,以及是否有可能尝试这样的连接?

jon*_*rpe 15

最好的方法是str.format:

template = """This is a 
multiline {0} with
replacement {1} in."""

print(template.format("string", "fields"))
Run Code Online (Sandbox Code Playgroud)