在Python中,你可以使用 `print()` 函数来询问变量的值。下面是一个简单的例子:
设置一个变量
x = "Hello Python world!"
打印变量的值
print(x)
当你运行这段代码时,它会输出:
Hello Python world!
如果你想要查看变量的数据类型,可以使用 `type()` 函数:
设置一个变量
x = 5
打印变量的数据类型
print(type(x))
这将输出:
这表示变量 `x` 的数据类型是整数(int)