在Python中,打印引号可以通过以下几种方法实现:
1. 使用转义字符:
print("\"Python\"") 打印双引号
print('Python') 打印单引号
2. 使用三引号:
print("""Python""") 打印双引号
print('''Python''') 打印单引号
print('Python') 打印单引号
print("Python") 打印双引号
4. 使用`format`方法:
print("{}'s my good friend!".format('Python')) 打印单引号
print("\"I really like Python!\"".format('Python')) 打印双引号
5. 使用f-string(Python 3.6+):
print(f'Python') 打印单引号
print(f"Python") 打印双引号
请根据您的需要选择合适的方法。