实例
a = "Hello"
print(a)
运行实例
多行字符串
您可以使用三个引号将多行字符串赋值给变量:
实例
您可以使用三个双引号:
a = """Python is a widely used general-purpose, high level programming language.
It was initially designed by Guido van Rossum in 1991
and developed by Python Software Foundation.
It was mainly developed for emphasis on code readability,
and its syntax allows programmers to express concepts in fewer lines of code."""
print(a)
运行实例
或三个单引号:
实例
a = '''Python is a widely used general-purpose, high level programming language.
It was initially designed by Guido van Rossum in 1991
and developed by Python Software Foundation.
It was mainly developed for emphasis on code readability,
and its syntax allows programmers to express concepts in fewer lines of code.'''
print(a)
运行实例
注释:在结果中,换行符插入与代码中相同的位置。