python 在Python中打印字符串和变量的三种方法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 在Python中打印字符串和变量的三种方法相关的知识,希望对你有一定的参考价值。

print "My name is" + first + " " + last
print "My name is", first, last
print "My name is {} {}".format(first, last)

以上是关于python 在Python中打印字符串和变量的三种方法的主要内容,如果未能解决你的问题,请参考以下文章

python中print()内,字符串相加‘,’和‘+’有啥区别?

如何在 Python 的同一行上打印变量和字符串?

Python中print()中既有字符串也有数字计算?

python 打印变量和字符串

0x21 python基础,兴趣为主

python中print怎么输出变量