In Python, can you have variables within triple quotes? If so, how?

后端 未结 7 1554
栀梦
栀梦 2020-12-14 05:33

This is probably a very simple question for some, but it has me stumped. Can you use variables within python\'s triple-quotes?

In the following example, how do use

7条回答
  •  自闭症患者
    2020-12-14 05:55

    Also note that you don't need the intermediate variable:

    name = "Alain"
    print """
    Hello %s
    """ % (name)
    

提交回复
热议问题