zoukankan      html  css  js  c++  java
  • python 全栈开发:python基础

    python具有优美、清晰、简单,是一个优秀并广泛使用的语言。
    诞生于1991年
    2.python历史

    • 1989年,为了打发圣诞节假期,Guido开始写Python语言的编译器。Python这个名字,来自Guido所挚爱的电视剧Monty Python’s Flying Circus。他希望这个新的叫做Python的语言,能符合他的理想:创造一种C和shell之间,功能全面,易学易用,可拓展的语言。
    • 1991年,第一个Python编译器诞生。它是用C语言实现的,并能够调用C语言的库文件。从一出生,Python已经具有了:类,函数,异常处理,包含表和词典在内的核心数据类型,以及模块为基础的拓展系统。
    • Granddaddy of Python web frameworks, Zope 1 was released in 1999
    • Python 1.0 - January 1994 增加了 lambdamapfilter and reduce.
    • Python 2.0 - October 16, 2000,加入了内存回收机制,构成了现在Python语言框架的基础
    • Python 2.4 - November 30, 2004, 同年目前最流行的WEB框架Django 诞生
    • Python 2.5 - September 19, 2006
    • Python 2.6 - October 1, 2008
    • Python 2.7 - July 3, 2010
    • In November 2014, it was announced that Python 2.7 would be supported until 2020, and reaffirmed that there would be no 2.8 release as users were expected to move to Python 3.4+ as soon as possible
    • Python 3.0 - December 3, 2008
    • Python 3.1 - June 27, 2009
    • Python 3.2 - February 20, 2011
    • Python 3.3 - September 29, 2012
    • Python 3.4 - March 16, 2014
    • Python 3.5 - September 13, 2015
    • Python 3.6 - December 16,2016


    python2与python3的区别:
    python2 源码不标准,混乱,重复代码太多。默认编码方式为ascii码,中文为会报错,解决方式:在文件的首行加-*- encoding:utf-8 -*-
    python3 统一标准,去除重复代码。默认编码方式为:utf-8
    3.python 的环境
    编译型:一次性将所有程序编译成二进制文件。(计算型)
    缺点:开发效率低,不能跨平台。
    优点:运行速度快。
    语言:C ,C++
    解释型:当程序执行时,一行一行的解释。
    缺点:运行速度慢。不能加密,线程不能利用多cpu问题。
    优点:开发效率高,可以跨平台。
    语言:python,php
    4.python的种类
    CPython、IPython、PyPy
    6.变量
    变量:就是将一些中间结果暂存到内存中,以便后续代码调用。
    1.规则必须由数字、字母、下划线任意组合,且不能数字开头。
    2.不能用python的关键字。

    以下关键字不能声明为变量名

    ['and', 'as', 'assert', 'break', 'class', 'continue', '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.变量具有可描述性。(age = 年龄)
    4.不能是中文。(python是世界性的。
    7. 常量:
    一直不变的量(比如:π)
    Python中常量用全大写表示(比如:BRI_OF_CHINA = 1949)
    8. 注释
    方便自己或他人理解代码。
    当行注释:#
    多行注释:'''注释内容''' """注释内容"""
    9.基础数据类型初识 (ps:type 查看类型)
    数字: int 123456
    + - * /
    % 取余数
    字符串:str, python当中凡是用引号一起来的都是字符串。
    可相加:字符串的拼接。
    可相乘:str * int
    布尔值:True False

  • 相关阅读:
    Memcache 缓存系统
    galera-cluster 集群
    CentOS 文件中行内容操作
    快速查找日志文件最后一行及某个时间段的日志
    CentOS 下生成随机颜色
    Linux 下紧急删除大文件不能及时释放空间应急处理办法
    Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*'
    Ant design vue 引入echarts
    .net core 发布时 IIS 站点 提示:文件名 web.config 错误:配置文件的 xml 格式不正确
    远程连接MySQL出现1130错误
  • 原文地址:https://www.cnblogs.com/henricks/p/9772075.html
Copyright © 2011-2022 走看看