- 让你的脚本再打印出一行。
- 让你的脚本只打印一行。
- 在任一行的开头放一个
#
,看看会发生什么?试着弄明白这个符号的作用。
1.
print("Hello World!")
print("Hello Again")
print("I like typing this.")
print("This is fun.")
print("Yay! Printing.")
print("I'd much rather you 'not'")
print('I "said" do not touch this.\n')
结果:
print("\n")是打印两行;print("hello world\n")是多打印一行 或者 print ("") 也是多打印一行
2.
print("Hello World!",end="")
print("Hello Again",end="")
print("I like typing this.",end="")
print("This is fun.",end="")
print("Yay! Printing.",end="")
print("I'd much rather you 'not'",end="")
print('I "said" do not touch this.\n',end="")
结果:
3. # 为注释