zoukankan      html  css  js  c++  java
  • python笔记1

    1.字典不包含从左到右的顺序

    2.If for 表达式:for x in xx:表达式  写为   表达式 for x in xx

    3.元组,字符串 不可变性

    (1)t.index()  t.count()

    (2)T[0]=1 #change #error

    (3)不能缩短、增长  无append

    4.创建文件 f=open(‘data.txt’,’w’) #默认为 ‘r'

               F.write(‘sherly’) #write strings of bytes to it returns number of bytes written

               F.close() #close to flush output buffers to disk

    Open binary data ‘rb’

    5.read() #字节  readline #

    6.集合

    X&Y #intersection

    X|Y #union

    X-Y #difference

    7.分数

    from fraction import Fraction

    f=Fraction(2,3)

    f+1

    #Fracion(5,3)

    8.检查处理对象的类型

    if type(L) == list:

                print('yes')

  • 相关阅读:
    foreach和each
    one
    存储
    动态添加
    百度描点
    php环境配置
    图文并茂
    css实现鼠标移上去变大,旋转,转别人的额
    vagrant box打包前的准备
    VirtualBox压缩打包
  • 原文地址:https://www.cnblogs.com/HackHer/p/5208568.html
Copyright © 2011-2022 走看看