在Python中,要输入表示温度的符号,如摄氏度(°C)或华氏度(°F),你可以使用Unicode字符实体。在Python 3中,你可以通过以下方式输入这些符号:
```python
print("温度为:{}°C".format(25)) 输出:温度为:25°C
print("温度为:{}°F".format(77)) 输出:温度为:77°F
如果你需要在字符串中动态插入这些符号,可以使用Unicode码点表示法:
```python
print(f"温度为:\N{DEGREE_SIGN}C".format(25)) 输出:温度为:25°C
print(f"温度为:\N{DEGREE_SIGN}F".format(77)) 输出:温度为:77°F
在这里,`\N{DEGREE_SIGN}` 是一个Unicode字符实体,代表度数符号(°)。