开始学习Python啦,希望能坚持下来,在博客园里记录一下学习过程,感谢博客园提供平台!

 Python发展史

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

1989年圣诞节,Guido开始写Python语言的编译器,Python这个名字源于Guido所挚爱的电视剧 Monty Python's Flying Circus

1991年,第一个Python编译器诞生,它是用C语言实现的,并能够调用C语言的库文件

1999年,Python web框架之祖,Zope 1诞生

1994年1月,Python 1.0,增加了lambda,map,filter 以及 reduce

2000年10月16日,Python 2.0,加入了内存回收机制,构成了现在Python语言框架的基础

2004年11月30日,Python 2.4,同年目前最流行的web框架Django诞生

2006年9月19日,Python 2.5

2008年10月1日,Python 2.6

2008年12月3日,Python 3.0

2009年6月27日,Python 3.1

2010年7月3日,Python 2.7

2011年2月20日,Python 3.2

2014年3月16日,Python 3.4

2015年9月13日,Python 3.5

2016年12月23日,Python 3.6

2018年3月,Guido在邮件列表上宣布Python 2.7将于2020年1月1日终止支持,并且不会退出2.8版本,希望用户尽快迁移至3.4以上的版本

2018年6月21日,Python 3.7

Python基础

变量赋值 

变量名 = 变量值
name = 'Tim' #name是string类型
print(type(name))
age = int('23') #将age强制转换为int型
print(type(age))

 

用户交互

name = input('name:')
age = int(input('age:'))
job = input('job:')
salary = int(input('salary:'))

info = '''
--------- info of %s ---------
Name:%s
Age:%d
Job:%s
Salary:%d
''' % (name, name, age, job, salary)

info2 = '''
--------- info of {n} ---------
Name:{n}
Age:{a}
Job:{j}
Salary:{s}
'''.format(n=name,
           a=age,
           j=job,
           s=salary)

info3 = '''
--------- info of {0} ---------
Name:{0}
Age:{1}
Job:{2}
Salary:{3}
'''.format(name, age, job, salary)

print(info3)

 

if else流程判断

if guess_age == age_of_tom:
    print('Right, you got it!')
elif guess_age > age_of_tom:
    print('think smaller...')
else:
    print('think bigger...')

 

while循环

while count < 3:
    guess_age = int(input('guess age:'))
    if guess_age == age_of_tom:
        print('Right, you got it!')
        break
    elif guess_age > age_of_tom:
        print('think smaller...')
    else:
        print('think bigger...')
    count += 1
else:
    print('You guessed wrong.')

 

for循环

for i in range(3):
    guess_age = int(input('guess age:'))
    if guess_age == age_of_tom:
        print('Right, you got it!')
        break
    elif guess_age > age_of_tom:
        print('think smaller...')
    else:
        print('think bigger...')
else:
    print('You guessed wrong.')
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄