python常用语句查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
#注释
'''
多行三点注释
'''
"""
多行注释
"""
if True:
    print("true")
else:
    print("false")
a1=b1=c1=99
d,e,f=1,2,"myname"
a, b, c, d = 20, 5.5, True, 4+3j
#int=199
#bool ture
#float=3e-2
#complex=1+2j
str="123456789"
print(str)
print(str[0:-1])
print(str[2:])
print(str[1:5:2])
#标准数据类型 6+2 bool(布尔类型)字节数组类型(bytes)
#不可变数据(3 个):Number(数字)、String(字符串)、Tuple(元组);
#可变数据(3 个):List(列表)、Dictionary(字典)、Set(集合)。
#数字类型   int、float、bool、complex(复数)。
print(type(d))
list1=["red0","bb1","cc2","ee3"]
list2=[10, 20, 30, 40, 50, 60, 70, 80, 90]
list1.append("ff4")
print(list1[0:1])
print(list1[4])
del list1[0]
print(list1[0])
print(len([8,1,3,4]))
 
for x in [1,2,3,5]:print(x,end="")
 
# 使用大括号 {} 来创建空字典
emptyDict = {'e1':1,22:333,ggg}
  
# 打印字典
print(emptyDict)
  
# 查看字典的数量
print("Length:", len(emptyDict))
  
# 查看类型
print(type(emptyDict))

  

posted @   飞雪飘鸿  阅读(42)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
https://damo.alibaba.com/ https://tianchi.aliyun.com/course?spm=5176.21206777.J_3941670930.5.87dc17c9BZNvLL
点击右上角即可分享
微信分享提示