Python 官方文档:入门教程 => 点击学习
一、单行注释 语法:#注释内容 说明:python中单行注释采用 # 开头,注释可以在语句或表达式行末 示例(文件名test.py): #!/usr/bin/Python # -*- coding: UTF-8 -*- # 这是单选注释 p
一、单行注释
语法:#注释内容
说明:python中单行注释采用 # 开头,注释可以在语句或表达式行末
示例(文件名test.py):
#!/usr/bin/Python
# -*- coding: UTF-8 -*-
# 这是单选注释
print "hello,python!";
代码截图:
运行截图:
二、多行注释
语法:
'''
注释内容
'''
或
"""
注释内容
"""
说明:python 中多行注释使用三个单引号(''')或三个双引号(""")
示例(文件名test.py):
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
打印hello,python1!
'''
print "hello,python1!";
"""
打印hello,python2!
"""
print "hello,python2!";
代码截图:
运行截图:
--结束END--
本文标题: python注释
本文链接: https://www.lsjlt.com/news/183241.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0