如何使用Python 2输出字符串并添加注释?
- 内容介绍
- 文章标签
- 相关推荐
本文共计214个文字,预计阅读时间需要1分钟。
python简化后的代码print(Wello World!)print(Hello Again!)print(I like typing this.)print(This is fun!)print(Yay! Printing.)print(I'd much rather you 'not'.)
exercise 1
print somthing you like
print("Hello Again!")
print('I like typing this.')
print("This is fun!")
print('Yay! Pringing.')
print("I'd much rather you 'not'.")
print('I "sad" do not touch this.')
注意:输出字符串的时候单双引号都可以,其他语言里面的反斜线转义在python里面也是生效的.
exercise 2
add a comment in your code
### this is a comment ,so that you can read it after a long time##
print("Hello , this is a comment !")
# test a program
print("This will run!")
print('this will not ## ## be ignored !')
注意:单行多行注释都是使用#符号,字符串里面的#后面的字符不会被注释.
本文共计214个文字,预计阅读时间需要1分钟。
python简化后的代码print(Wello World!)print(Hello Again!)print(I like typing this.)print(This is fun!)print(Yay! Printing.)print(I'd much rather you 'not'.)
exercise 1
print somthing you like
print("Hello Again!")
print('I like typing this.')
print("This is fun!")
print('Yay! Pringing.')
print("I'd much rather you 'not'.")
print('I "sad" do not touch this.')
注意:输出字符串的时候单双引号都可以,其他语言里面的反斜线转义在python里面也是生效的.
exercise 2
add a comment in your code
### this is a comment ,so that you can read it after a long time##
print("Hello , this is a comment !")
# test a program
print("This will run!")
print('this will not ## ## be ignored !')
注意:单行多行注释都是使用#符号,字符串里面的#后面的字符不会被注释.

