Python-based, installation notes, common delays

Python Installation

Today was speaking entirely in Windows

Enter the official website now Python installation package search directly in the browser: Python.org

The first step: opening the Downloads: after the second step: Choose Windows

Fool, fool-you can download directly point to open, but smart download this version, some people are willing to download another version it is necessary to use other methods

Select the version you want, you can see, is a Windows-x86 there is a Windows-x86-64 is thirty-two of the former, the latter sixty four bits, in accordance with their own version of this computer download, and then click to download the exe is followed by a

Download Well, the next step is to install

This is the beginning of the page, we can select the above fool a key installation, the default path is in the C drive, we can select the following custom installation, remember to put the hook on the following PATH before installation , this is necessary environment variables, if not, then the hook is not afraid, you can also copy the path set by his own.

Here matter directly click Next, install, well, after installing Let's try it good

Open CMD then enter Python, to see if added to the environment variables, very good installed.

Understanding of the basic types in Python

Python3 There are six basic standard data types, but also the basis of

  1. Numbers (Digital)

  2. String (String)

  3. List (list)

  4. Tuple (tuple)

  5. Sets (collections)

  6. Dictionaries (Dictionary)

Numbers (Digital)

Digital is divided into three types

  • Integer - often referred to is an integer or an integer, is positive or negative integer, with no decimal.

  • Float - a floating-point integer part and a decimal part, it may also be represented float (2.5e2 = 2.5 x 102 = 250 ) using scientific notation

  • Complex - a complex composed of a real part and an imaginary part, may be used a + bj, or Complex (a, b) indicates, the real part and the imaginary part b is a float.

PS:Python3 整型是没有限制大小的,所以 Python3 没有 Python2 的 Long 类型。

首先我们来看一下Numbers的类型转换

有简单的数值运算:

Python安装与基本数据类型,倘想达到最高处,就要从低处开始

注意:

  1. Python可以同时为多个变量赋值,如a, b = 1, 2。

  2. ⼀个变量可以通过赋值指向不同类型的对象。

  3. 数值的除法(/)总是返回⼀个浮点数,要获取整数使⽤//操作符。

  4. 在混合计算时,Pyhton会把整型转换成为浮点数。

再来看一下数学函数都有什么,怎么用

还有随机数函数要怎么用呢?

Python还有很多的三角函数

String(字符串)

字符串的大小写转换

字符串的格式输出

字符串搜索定位与替换

字符串的联合与分割

字符串条件判断

List(列表)

列表是Python 中使⽤最频繁的数据类型。列表是写在⽅括号之间、⽤逗号分隔开的元素列表。列表中元素的类型可以不相同:

列表是写在⽅括号之间、⽤逗号分隔开的元素列表。列表中元素的类型可以不相同

和字符串⼀样,列表同样可以被索引和切⽚,列表被切⽚后返回⼀个包含所需元素的新列表。详细的在这⾥就不赘述了。

除了这些,列表还⽀持串联操作,使⽤+操作符:

基础为重,Python的基础,成就月薪过万

与之前讲的字符串不⼀样的是,列表中的元素是可以改变的:

PS:

  1. List写在⽅括号之间,元素⽤逗号隔开。

  2. 和字符串⼀样,list可以被索引和切⽚。

  3. List可以使⽤+操作符进⾏拼接。

  4. List中的元素是可以改变的。

Tuple(元组)

元组与列表类似,不同之处在于元组的元素不能修改。元组写在⼩括号⾥,元素之间⽤逗号隔开。

元组中的元素类型也可以不相同,元组与字符串类似,可以被索引且下标索引从0开始,也可以进⾏截取/切⽚

其实,可以把字符串看作⼀种特殊的元组。

虽然tuple的元素不可改变,但它可以包含可变的对象,⽐如list列表。构造包含0个或1个元素的tuple是个特殊的问题,所以有⼀些额外的语法规则

现在手上也有一些Python的资料视频,大家可以加q-u-n 二二七,四三五,四五零 免费获取资料哈~

PS:

  1. 与字符串⼀样,元组的元素不能修改。

  2. 元组也可以被索引和切⽚,⽅法⼀样。

  3. 注意构造包含0或1个元素的元组的特殊语法规则。

  4. 元组也可以使⽤+操作符进⾏拼接。

Sets(集合)

集合是⼀个⽆序不重复元素的集。

基本功能是进⾏成员关系测试和消除重复元素。

可以使⽤⼤括号 或者 set()函数创建set集合,注意:创建⼀个空集合必须⽤ set() ⽽不是 { },因为{ }是⽤来创建⼀个空字典。

基

Dictionaries(字典)

我们最后再来介绍,字典是Python中另⼀个⾮常有⽤的内置数据类型。

字典是⼀种映射类型,它是⼀个⽆序的键 : 值对集合。关键字必须使⽤不可变类型,也就是说list和包含可变类型的tuple不能做关键字。在同⼀个字典中,关键字还必须互不相同。

PS:

  1. 字典是⼀种映射类型,它的元素是键值对。

  2. 字典的关键字必须为不可变类型,且不能重复。

  3. 创建空字典使⽤{ }。

做为一个过来人,我要告诉你请教前辈大牛真的很重要,可以让你少走很多的弯路,不要怕丢人,没面子,面子值几个钱?学到真本事才最重要。没有技能才叫真的没有面子。python技术分享,让你的前途不再迷茫。

推荐阅读:零基础学Python,越早明白这些,越快找到好工作!

Guess you like

Origin blog.csdn.net/weichen090909/article/details/90647643