```python
text = "Hello"
number = 42
print(text + " " + str(number)) 使用字符串拼接
2. 格式化字符串:
```python
text = "Hello"
number = 42
print("{} {}".format(text, number)) 使用format()方法
或者使用f-string(Python 3.6+):
```python
text = "Hello"
number = 42
print(f"{text} {number}") 使用f-string
3. 使用`%`操作符进行格式化:
```python
text = "My name is %s and I am %d years old." % ("Alice", 30) 使用%操作符
4. 使用`str.format()`方法:
```python
text = "My name is {} and I am {} years old."
print(text.format("Alice", 30)) 使用str.format()方法
以上方法都可以在Python中打印出文字和数字的组合。选择哪种方法取决于你的具体需求和Python的版本