在 Python 中打印多种数据类型的语法是什么? [英] What is the syntax for printing multiple data types in Python?

查看:52
本文介绍了在 Python 中打印多种数据类型的语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有:

`my_float = 1.5`
`my_int = 1`

如何在 Python 中打印 "[float] 大于 [int]"?

How do I print "[float] is larger than [int]" in Python?

推荐答案

例如:

name = "Sven
age = 20
city = "a house"
print("Hello, your name is {name}, you are {age} years old and you live in {city}".format(name=name, age=age, city=city)

将输出:

Hello, your name is Sven, you are 20 years old and you live in a house.

这篇关于在 Python 中打印多种数据类型的语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆