01 Python简介

Python是一种跨平台的计算机程序设计语言。于1989年开发的语言,创始人范罗苏姆(Guido van Rossum),别称:龟叔(Guido)。

python具有非常多并且强大的第三方库,使得程序开发起来得心应手。

Python“信条”:人生苦短,我用python!(Life is short,you need Python。)

02 Python 版本

  • python 2.x 版本,官方在 2020 年停止支持,原码不规范,重复较多

  • python 3.x 版本,功能更加强大且修复了很多bug,原码清晰,简单

Let's not play games with semantics. The way I see the situation for 2.7 is that EOL is January 1st, 2020, and there will be no updates, not even source-only security patches, after that date. Support (from the core devs, the PSF, and python.org) stops completely on that date. If you want support for 2.7 beyond that day you will have to pay a commercial vendor. Of course it's open source so people are also welcome to fork it. But the core devs have toiled long enough, and the 2020 EOL date (an extension from the originally annouced 2015 EOL!) was announced with sufficient lead time and fanfare that I don't feel bad about stopping to support it at all.【原文链接

03 Python擅长的领域

  • Web开发:Django、pyramid、Tornado、Bottle、Flask、WebPy

  • 网络编程:Twisted、Requests、Scrapy、Paramiko

  • 科学运算:SciPy、Pandas、lpython

  • GUI图形开发:wxPython、PyQT、Kivy

  • 运维自动化:OpenStack、SaltStack、Ansible、腾讯蓝鲸

04 Python解释器(部分):

  • (1)Cpython(官方推荐):把python转化成c语言能识别的二进制码

  • (2)Jpython:把python转化成java语言能识别的二进制码

  • (3)其他语言解释器:把python转化成其他语言能识别的二进制码

  • (4)PyPy:将所有代码一次性编译成二进制码,加快执行效率(模仿编译型语言的一款python解释器)

05 2020年10月TIOBE指数

06 Python环境的安装

Windows

下载安装包:https://www.python.org/downloads/

配置环境变量:【右键计算机】-->【属性】-->【高级系统设置】-->【高级】-->【环境变量】-->【在系统变量中找到 Path,双击或编辑】-->【添加Python安装目录,如;C:\python38,切记前面有英文标点分号(win10系统变量与win7大体一致)】

Linux、Mac

无需安装,系统自带Python环境,但是可选择升级版本。

07 编写第一个Python程序

print("Hello World!")

08 编译型与解释型语言区别(补充)

  • 编译型:一次性把所有代码编译成机器能识别的二进制码再运行

    • 代表语言:c,c++
    • 优点:执行速度快
    • 缺点:开发速度慢,调试周期长
  • 解释型:代码从上到下一行一行解释并运行:
    • 代表语言:python,php
    • 优点:开发效率快,调试周期短
    • 缺点:执行速度相对慢

09 与其它编程语言的对比

C++

#include <iostream>
using namespace std;
int main()
{
cout << "Hello World";
return 0;
}

C

#include <stdio.h>
int main()
{
/* 我的第一个 C 程序 */
printf("Hello, World! \n");
return 0;
}

C#

using System;
namespace HelloWorldApplication
{
class HelloWorld
{
static void Main(string[] args)
{
/* 我的第一个 C# 程序*/
Console.WriteLine("Hello World!");
Console.ReadKey();
}
}
}

Java

public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World!");
}
}

PHP

<?php
echo 'Hello World!';
?>

Ruby

puts "Hello World!";

Go

package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}

Python

print("Hello, World!");

10 Python之禅(扩展)

import this

Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Special cases aren't special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess.

There should be one-- and preferably only one --obvious way to do it.

Although that way may not be obvious at first unless you're Dutch.

Now is better than never.

Although never is often better than right now.

If the implementation is hard to explain, it's a bad idea.

If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea -- let's do more of those!

初试Python的更多相关文章

  1. 初试Python语法小试牛刀之冒泡排序

    Python很火,心里很慌,没吃过猪肉,也要见见猪走路. 看了几天Python的语法,大概初步了解了一点点,https://www.liaoxuefeng.com/wiki/0014316089557 ...

  2. Python Web-第四周-Programs that Surf the Web(Using Python to Access Web Data)

    1.Understanding HTML 1.最简单的爬虫 import urllib fhand=urllib.urlopen('http://www.dr-chuck.com/page1.htm' ...

  3. 初试PyOpenGL四 (Python+OpenGL)GPU粒子系统与基本碰撞

    这篇相当于是对前三篇的总结,基本效果如下: 在初试PyOpenGL一 (Python+OpenGL)讲解Pyopengl环境搭建,网格,球体,第一与第三人称摄像机的实现.在初试PyOpenGL二 (P ...

  4. python性能监控初试

    标 题: python性能监控初试作 者: itdef链 接: http://www.cnblogs.com/itdef/p/3990765.html 欢迎转帖 请保持文本完整并注明出处 之前性能统计 ...

  5. [python]初试页面抓取——抓取沪深股市交易龙虎榜数据

    [python]抓取沪深股市交易龙虎榜数据 python 3.5.0下运行 没做自动建立files文件夹,需要手动在py文件目录下建立files文件夹后运行 #coding=utf-8 import ...

  6. Python基本语法初试

    编程环境: win7旗舰版 Python 3.2.2(default, Sep  4 2011,09:51:08) 代码来源:(Python菜鸟) 代码内容: Python基本的输出语句print(& ...

  7. python初试牛刀

    需求:在L7的一台机器上做nginx配置,然后代码分发到别的所有的机器上.由于目录中有很多配置文件,而且防止误操作,需要修改配置之前先备份原配置.然后需要在运行修改配置的脚本之前,先弹出界面,告知操作 ...

  8. python爬虫框架scrapy初试(二)

    将该导航网站搜索出结果的页面http://www.dmoz.org/Computers/Programming/Languages/Python/Books/里面标题,及标题的超链接和描述爬下来. 使 ...

  9. 初试PyOpenGL二 (Python+OpenGL)基本地形生成与高度检测

    在上文中,讲述了PyOpenGL的基本配置,以及网格,球形的生成,以及基本的漫游.现在利用上一篇的内容,来利用高程图实现一个基本的地形,并且,利用上文中的第三人称漫游,以小球为视角,来在地形上前后左右 ...

随机推荐

  1. yum wget rpm

    wget 类似于迅雷,是一种下载工具          下载安装包 yum: 是redhat, centos 系统下的软件安装方式 下载安装包并自动安装 以及一些依赖关系 基于RPM包管理,能够从指定 ...

  2. leetcode刷题-86分隔链表

    题目 给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前. 你应当保留两个分区中每个节点的初始相对位置. 示例: 输入: head = 1->4 ...

  3. 提升开发幸福度-IDE配置

    插件 vscode插件 Settings Sync Atom One Dark Theme Bracket Pair Colorizer Code Runner Dracular Official E ...

  4. [翻译] 发布双屏预览SKD,公布MICROSOFT 365开发者日日期

    [前置提示]:本文翻译工作尚未完工,您可以先看原文QUQ 原文标题:Announcing dual-screen preview SDKs and Microsoft 365 Developer Da ...

  5. day51:django:dispatch&模板渲染&过滤器&标签&组件&静态文件配置

    目录 1.dispatch 2.模板渲染 3.过滤器 4.标签 5.组件 6.静态文件配置 dispatch 回顾:CBV对应的URL传参 urls.py url(r'^book/(\d+)/(\d+ ...

  6. hystrix文档翻译之工作原理

    流程图 下面的图片显示了一个请求在hystrix中的流程图. 1.构造一个HystrixCommand或者HystrixObservableCommand对象 第一步是创建一个HystrixComma ...

  7. 每天一个dos命令-net.

    Rem:关于net命令相关的常用实例(如果cmd中执行net相关命令,报错:Access is denied. 可以右键cmd,以管理员身份运行即可!) 1.创建一个新账号:net user ifsf ...

  8. BTRsys1~2系列靶机渗透

    BTRsys系列靶机渗透 BTRsys1 端口发现加目录扫描. 发现目录:http://192.168.114.161/login.php 尝试弱密码失败,查看源代码. <script type ...

  9. 【Django】将多个querysets拼接,使用djangorestframework序列化

    concern_set = models.Concern.objects.filter(user_id=1).values("concern_id") querysets = mo ...

  10. java原生程序redis连接(连接池/长连接和短连接)选择问题

    最近遇到的连接问题我准备从重构的几个程序(redis和mysql)长连接和短连接,以及连接池和单连接等问题用几篇博客来总结下. 这个问题的具体发生在java原生程序和redis的交互中.这个问题对我最 ...