python 之路N01'

2021-07-11 22:06

阅读:511

标签:print   字母   单行注释   多行   不能   变量   oba   continue   with   

1、注释:

单行注释:#

多行注释:‘’‘  ‘’’

2、变量的定义:

  • 变量名只能是字母、数字、下划线组合
  • 第一个字符不能是数字
  • 关键字不能声明为变量(and,as,assert,break,class,contine,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,not,or,pass,print,raise,return,try,while,with,yield)                                                                                                                           

3、info=‘‘‘

    -----info of {_name}-------

Name={_name}

Age={_age}

‘‘‘.format(_name=name,_age=age)

 

info=‘‘‘

    -----info of {0}-------

Name={0}

Age={1}

‘‘‘.format(name,age)

4、getpass:隐藏输入

import getpass

password=getpass.getpass(‘password:‘)

5、while 、for循环

while True:

else:

for i in range(10)

else:

for i in range(0,10,2):从0到10 ,步长为2,默认是1

6、continue:跳出本次循环进入下一个循环

     break:结束循环

    2018-08-28

python 之路N01'

标签:print   字母   单行注释   多行   不能   变量   oba   continue   with   

原文地址:https://www.cnblogs.com/cm920/p/9549899.html


评论


亲,登录后才可以留言!