美文网首页
python基础

python基础

作者: a风风a | 来源:发表于2018-06-01 17:57 被阅读51次

1、x,y = y,x

2、2/2  ->1.0

    2//2 ->1

    1//2 ->0

3、2,8,10,16转化表示和自带的方法

4、单引号,双引号,三引号区别

5、bool:True,False

6、原始字符串用 r或R

    print( r'hello\n world')  -> hello\n world

      print( 'hello\n world')   -> hello

                                             world 

7、

选择

:选择的也是列表,直接选择是元素

8、[1,2,3] 列表list

        (1,2,3)元组tuple       可以序列解包获取  tuble1,tuble2,tuble3 =(1,2,3)   比(1,2,3)[0]要好

        {1,2,3}集合set,无序,不重复 {1,2,2,3}-> {1,2,3}  

集合操作

    {1:1,2:2,3:3}字典dict,key:value

字典

9、基本数据类型总结

数据类型总结

10、对象的三个特征value,id,type    对应   ==,is,type()

判断类型的一种方法   isinstance(5,int) ->true    isinstance(5,(int,str)) ->true

相关文章

网友评论

      本文标题:python基础

      本文链接:https://www.haomeiwen.com/subject/qklksftx.html