Python学习之路 第三篇 Python基础(一)
1.IDLE的使用:IDLE是Python编程的编辑器 shell命令只能一次一次的执行程序,摁CTRL+N进入可多行编辑界面。 注释和注释法:注释能让写的程序失效。注释法包括“#”注释法【单行注释】,三引号注释法【多行注释】(要在英文书写模式中进行三引号注释中文状态下可能会无效)。 # import re # string="peceython" # pat="p.*y" # rst=re.search(pat,string,re.I) # print(rst) ''' import re string="peceython" pat="p.*y" rst=re.search(pat,string,re.I) print(rst) ''' 在PyCharm中还能用CTRL+?注释选中的所有代码。 字符串: 用引号引起来的字符叫做字符串。 #字符串(引号): name = " linux " name = ' alex ' name = """ zlex """ name = ''' dgugu ''' #加法: >>> n1="alex" >>> n2="liunx" >>> n3=n1+n2 >>> print(n3) alexliunx #乘法 >>> n1="fgywfgw" >>> n2=n1*15 >>> print(n2)