zoukankan      html  css  js  c++  java
  • day02_字符编码

    1.编码格式化输出:%s   %d   %

    print("姓名%s,年龄%d"%(tom,12))

    2.编码:

    ascii 只显示英文,特殊字符,数字   00000000    八位 2**8=256  一开始7位,多预留一位

    万国码:Unicode   最开始16位,中文不够(九万多字,最少需要3个字节) 分配32位 4个字节

    utf-8:最少用一个字节,8位表示一个英文

      欧洲16位,2个字节

      亚洲24位,3个字节

    gbk:用于中文(2个字节)与英文 

    1bit 8bit = 1bytes
    1byte 1024byte = 1KB
    1KB 1024kb = 1MB
    1MB 1024MB = 1GB
    1GB 1024GB = 1TB

    3.逻辑运算符

    #and or not
    #优先级,()> not > and > or
    # print(2 > 1 and 1 < 4)
    # print(2 > 1 and 1 < 4 or 2 < 3 and 9 > 6 or 2 < 4 and 3 < 2)
    # T or T or F
    #T or F
    # print(3>4 or 4<3 and 1==1) # F
    # print(1 < 2 and 3 < 4 or 1>2) # T
    # print(2 > 1 and 3 < 4 or 4 > 5 and 2 < 1) # T
    # print(1 > 2 and 3 < 4 or 4 > 5 and 2 > 1 or 9 < 8) # F
    # print(1 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6) # F
    # print(not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6) # F

    #ps int ----> bool 非零转换成bool True 0 转换成bool 是False
    # print(bool(2))
    # print(bool(-2))
    # print(bool(0))
    # #bool --->int
    # print(int(True)) # 1
    # print(int(False)) # 0


    '''x or y x True,则返回x'''                   and 与  or相反,返回y
    # print(1 or 2) # 1
    # print(3 or 2) # 3
    # print(0 or 2) # 2
    # print(0 or 100) # 100


    # print(2 or 100 or 3 or 4) # 2

    # print(0 or 4 and 3 or 2)
    '''x and y x True,则返回y'''
    # print(1 and 2)
    # print(0 and 2)
    print(2 or 1 < 3)
    print(3 > 1 or 2 and 2)

  • 相关阅读:
    Sencha Touch 框架快速入门系列
    dotTrace 使用说明
    CQRS架构中同步服务的一种实现方式
    C#中循环结构的效率问题
    面向领域驱动架构的查询实现方式
    最佳 jQuery
    DWZ&MVC的探索系列——Demo演示效果
    在Windows Azure中实现和调试一个WCF服务(上)
    现代软件工程开发体验:结对编程
    结对编程是什么?
  • 原文地址:https://www.cnblogs.com/wzc27229/p/10915156.html
Copyright © 2011-2022 走看看