写作灵感来源于John Zelle的Python程序设计(第三版)
print()用途
1.print()函数用于打印数据,数据类型(int, float,string)
例如>>> print (0)
0
print (0.55)
0.55
print (‘hello world’)
hello world2.拥有计算功能,字符串相加,相乘
print(5+56)
61
print(‘hello’+’world’+’ ‘+’5.02’)
helloworld 5.02
print(‘hello’+’world’+’ ‘+’5.02’*8)
helloworld 5.025.025.025.025.025.025.025.02
3.转义字符串
>>> print ('sdf\n')
sdf
>>> print('\n')
>>> print ('\\n')
\n
>>> print ('\\\\\\\\n')
\\\\n
值得注意的是别忘了加引号
晚辈学艺不精,学Python没有多久,这是第一篇博文,感觉很陌生,抱歉。
下面分享一下编程技巧:
在shell中,你想使用你打过的语句
用Alt+P 到下一条语句
用Alt+N 到上一条语句
函数名称未打完可以用tab补全
按f5可以快速运行idle
你要将一大群语句缩进时,可以鼠标选择,后点击tab向右缩进,同按shift+tab可以向左缩进