zoukankan      html  css  js  c++  java
  • python--数据类型

    标准数据类型

    • Numbers(数字)
    • String(字符串)
    • List(列表)
    • Tuple(元组)
    • Dictionary(字典)

    布尔值(bool boolean)
    True False 首字母大写

    字符串 str
    成对的 单引号 双引号 三引号 括起来的内容,赋值给某个变量,就是字符串.
    a='6'
    b="hi"
    c='''666'''
    d="""888"""
    print(type(a))

     

    判断数据类型:
    type(数据)
    int float str boolean dict list tuple
    c='ddd'
    print(type(c))


    元素:

    字符串里面的元素:单个字母、数字、汉字、符号,都称之为元素

    统计数据的长度:
    len(数据)
    s='1212'

    print(len(s))


    标识符:写代码时,命名的符号

    1:项目名: project name
    2:包名:package name
    3:模块名:.py
    4:函数名 :def 函数名()
    5:类名 : class 类名:

    标识符规范:
    1:由字母、数字、下划线组成,但是不能以数字开头
    2:见名知意
    3:不同字母、数字之间,用下划线隔开,提高可读性
    4:不能用关键字(int if while)

  • 相关阅读:
    Valid Parentheses
    Remove Nth Node From End of List
    守护线程、守护进程
    4Sum
    Letter Combinations of a Phone Number
    3sum closest
    Excel Sheet Column Number
    Majority Element
    Balanced Binary Tree
    Maximum Depth of Binary Tree
  • 原文地址:https://www.cnblogs.com/angle13991/p/14388244.html
Copyright © 2011-2022 走看看