当前位置:首页>python>Python教程 — 数据结构:列表、元组、字典、集合

Python教程 — 数据结构:列表、元组、字典、集合

  • 2026-07-03 06:32:06
Python教程 — 数据结构:列表、元组、字典、集合

> 上节课我们搞定了环境搭建和基础语法,今天进入 Python 最强大的部分——数据结构。

---

## 一、为什么数据结构如此重要?

如果说变量是砖头,那数据结构就是钢筋水泥。学会数据结构,你才能:

1.**高效组织数据**——不再到处传零散变量

2.**利用内置方法**——Python 为每种数据结构提供了丰富的操作方法

3.**写出更 Pythonic 的代码**——列表推导式、字典推导式是 Python 的精髓

---

## 二、列表(List)—— Python 最常用的数据结构

### 2.1 列表的基础操作

```python

# 创建列表

fruits = ["苹果""香蕉""橙子""葡萄"]

numbers = [12345]

mixed = [1"hello"3.14True]  # Python 列表可以混装不同类型

# 索引访问(从0开始)

print(fruits[0])   # 苹果

print(fruits[-1])  # 葡萄(负索引表示从末尾数)

# 切片操作(超好用!)

print(fruits[1:3])  # ['香蕉', '橙子'](左闭右开)

print(fruits[:2])   # ['苹果', '香蕉'](省略前面相当于从0开始)

print(fruits[2:])   # ['橙子', '葡萄'](省略后面相当于到最后)

# 修改列表元素

fruits[1] = "芒果"

print(fruits)  # ['苹果', '芒果', '橙子', '葡萄']

# 添加元素

fruits.append("西瓜")       # 追加到末尾

fruits.insert(1"草莓")    # 插入到指定位置

fruits.extend(["樱桃""蓝莓"])  # 批量追加

# 删除元素

fruits.remove("芒果")       # 按值删除

popped = fruits.pop()       # 弹出最后一个并返回

popped = fruits.pop(2)      # 弹出指定位置的元素

del fruits[0]               # 按索引删除(没有返回值)

# 列表长度

print(len(fruits))  # 剩余元素数量

# 查找元素

print(fruits.index("橙子"))  # 返回索引位置

print("香蕉"in fruits)      # True/False,判断是否存在

```

### 2.2 列表排序与反转

```python

names = ["张三""李四""王五""赵六"]

numbers = [643425712990]

# 升序排列

numbers.sort()

print(numbers)  # [25, 29, 34, 64, 71, 90]

# 降序排列

numbers.sort(reverse=True)

print(numbers)  # [90, 71, 64, 34, 29, 25]

# 字母排序(中文按拼音/Unicode)

names.sort()

print(names)

# 反转(不排序,单纯倒过来)

numbers.reverse()

# 不修改原列表,返回新排序列表

original = [643425712990]

sorted_numbers = sorted(original)

print(sorted_numbers)    # [25, 29, 34, 64, 71, 90]

print(original)          # 原始列表不变

```

### 2.3 列表推导式(List Comprehension)—— Python 的灵魂语法

```python

# 普通写法:生成 0-9 的平方

squares = []

for x inrange(10):

    squares.append(x ** 2)

# 推导式写法(一行搞定)

squares = [x ** 2for x inrange(10)]

print(squares)  # [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

# 带条件过滤:只保留偶数的平方

even_squares = [x ** 2for x inrange(10if x % 2 == 0]

print(even_squares)  # [0, 4, 16, 36, 64]

# 字符串操作:首字母大写

words = ["hello""world""python""code"]

capitalized = [w.capitalize() for w in words]

print(capitalized)  # ['Hello', 'World', 'Python', 'Code']

# 嵌套推导式:矩阵转置

matrix = [

    [123],

    [456],

    [789]

]

transposed = [[row[i] for row in matrix] for i inrange(3)]

print(transposed)  # [[1, 4, 7], [2, 5, 8], [3, 6, 9]]

# 实际应用:扁平化嵌套列表

nested = [[123], [45], [6789]]

flattened = [num for sublist in nested for num in sublist]

print(flattened)  # [1, 2, 3, 4, 5, 6, 7, 8, 9]

```

### 2.4 深浅拷贝

```python

# 浅拷贝:只复制第一层

original = [12, [34]]

shallow_copy = original.copy()  # 或 list(original)

shallow_copy[2][0] = 99

print(original)     # [1, 2, [99, 4]]  ← 嵌套对象也被改了!

print(shallow_copy) # [1, 2, [99, 4]]

# 深拷贝:完全复制,互不影响

import copy

deep_copy = copy.deepcopy(original)

deep_copy[2][0] = 3

print(original)     # [1, 2, [99, 4]]  ← 不受影响

print(deep_copy)    # [1, 2, [3, 4]]

```

---

## 三、元组(Tuple)—— 不可变的列表

```python

# 创建元组

rgb = (2551280)

coordinate = (35)

single_element = (42,)  # 注意:单个元素必须加逗号!

# 元组是不可变的(不能修改元素)

# rgb[0] = 100  ← 这会报错!TypeError

# 但可以用于:

# 1. 保护数据不被修改

# 2. 函数的多返回值

defget_user_info():

return"张三"25"北京"

name, age, city = get_user_info()  # 解包赋值

print(f"{name}{age}岁,住在{city}")

# 3. 字典的键(列表不行,元组可以)

grades = {("数学"2026): 95, ("英语"2026): 88}

print(grades[("数学"2026)])  # 95

```

---

## 四、字典(Dictionary)—— 键值对集合

### 4.1 字典基础

```python

# 创建字典

student = {

"name""张三",

"age"20,

"grade""A",

"courses": ["数学""物理""化学"]

}

# 访问值

print(student["name"])          # 张三

print(student.get("email""N/A"))  # N/A(不会报错,键不存在返回默认值)

# 修改/添加

student["email"] = "zhangsan@example.com"

student["age"] = 21

# 删除

del student["grade"]

popped = student.pop("age")  # 删除并返回值

# 遍历字典

for key, value in student.items():

print(f"{key}{value}")

for key in student.keys():

print(key)

for value in student.values():

print(value)

# 检查键是否存在

print("email"in student)  # True

```

### 4.2 字典推导式

```python

# 平方映射

squares_dict = {x: x**2for x inrange(16)}

print(squares_dict)  # {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

# 从两个列表构建字典

names = ["Alice""Bob""Charlie"]

scores = [958792]

score_dict = {name: score for name, score inzip(names, scores)}

print(score_dict)  # {'Alice': 95, 'Bob': 87, 'Charlie': 92}

# 条件过滤

words = ["apple""banana""cherry""date"]

short_words = {w: len(w) for w in words iflen(w) <= 5}

print(short_words)  # {'apple': 5, 'date': 4}

```

### 4.3 字典实用技巧

```python

from collections import defaultdict, Counter

# defaultdict:访问不存在的键时自动创建默认值

scores = defaultdict(list)

scores["数学"].append(95)

scores["数学"].append(88)

scores["英语"].append(92)

print(dict(scores))  # {'数学': [95, 88], '英语': [92]}

# Counter:计数器,统计元素出现次数

words = ["apple""banana""apple""orange""banana""apple"]

word_counts = Counter(words)

print(word_counts)  # Counter({'apple': 3, 'banana': 2, 'orange': 1})

print(word_counts.most_common(2))  # [('apple', 3), ('banana', 2)]

# 合并字典(Python 3.9+)

dict1 = {"a"1"b"2}

dict2 = {"b"3"c"4}

merged = {**dict1, **dict2}  # {"a": 1, "b": 3, "c": 4}

merged = dict1 | dict2       # 等价写法

```

---

## 五、集合(Set)—— 去重与数学运算

```python

# 创建集合

fruits_a = {"苹果""香蕉""橙子"}

fruits_b = {"香蕉""橙子""葡萄"}

# 自动去重

numbers = [122333445]

unique_numbers = set(numbers)

print(unique_numbers)  # {1, 2, 3, 4, 5}

# 集合运算

print(fruits_a | fruits_b)   # 并集:{'苹果', '香蕉', '橙子', '葡萄'}

print(fruits_a & fruits_b)   # 交集:{'香蕉', '橙子'}

print(fruits_a - fruits_b)   # 差集:{'苹果'}

print(fruits_a ^ fruits_b)   # 对称差集:{'苹果', '葡萄'}(只出现在其中一个集合的元素)

# 添加/删除

fruits_a.add("西瓜")

fruits_a.update(["草莓""蓝莓"])

fruits_a.remove("西瓜")      # 删除不存在的元素会报错

fruits_a.discard("西瓜")     # 更安全,不存在也不会报错

# 判断关系

subset = {12}

superset = {123}

print(subset.issubset(superset))    # True

print(superset.issuperset(subset))  # True

```

---

## 六、字符串处理

### 6.1 字符串基础操作

```python

text = "Python is awesome"

# 基础方法

print(text.upper())        # PYTHON IS AWESOME

print(text.lower())        # python is awesome

print(text.title())        # Python Is Awesome

print(text.swapcase())     # pYTHON IS AWESOME

# 查找

print(text.find("awesome"))    # 10

print(text.rfind("a"))         # 16(从右边找)

print("xyz"in text)           # False

# 替换

new_text = text.replace("awesome""fantastic")

# 分割/拼接

sentence = "Python, is, awesome"

parts = sentence.split(",")       # ['Python', ' is', ' awesome']

joined = " ".join(parts)          # Python is awesome

# 去除空白

dirty_text = "  hello world  "

clean_text = dirty_text.strip()    # 'hello world'

clean_left = dirty_text.lstrip()   # 'hello world  '

clean_right = dirty_text.rstrip()  # '  hello world'

# 判断

print("abc123".isalpha())   # False(包含数字)

print("123".isdigit())      # True

print("ABC".isupper())      # True

print("".isspace())         # False

```

### 6.2 格式化字符串回顾

```python

name = "张三"

age = 25

score = 95.678

# f-string(推荐)

print(f"我叫{name},今年{age}岁,成绩{score:.1f}")

# 我叫张三,今年25岁,成绩95.7

# 对齐

print(f"|{'内容':<20}|")  # |内容                  |(左对齐)

print(f"|{'内容':>20}|")  # |                 内容|(右对齐)

print(f"|{'内容':^20}|")  # |         内容         |(居中)

# 千位分隔符

print(f"{1234567:,.2f}")  # 1,234,567.00

# 二进制/十六进制

print(f"{42:b}")  # 101010(二进制)

print(f"{42:x}")  # 2a(十六进制)

```

---

## 七、实战项目:联系人管理系统

```python

# 使用字典构建一个简单的联系人管理程序

contacts = {}

defadd_contact(namephone):

if name in contacts:

print(f"⚠️ 联系人 {name} 已存在")

else:

        contacts[name] = {"phone": phone}

print(f"✅ 已添加 {name}")

defsearch_contact(name):

if name in contacts:

        info = contacts[name]

print(f"📱 {name}{info['phone']}")

else:

print(f"❌ 未找到 {name}")

defdelete_contact(name):

if name in contacts:

del contacts[name]

print(f"🗑️ 已删除 {name}")

else:

print(f"❌ 未找到 {name}")

deflist_all_contacts():

ifnot contacts:

print("📭 通讯录为空")

return

print("\n" + "=" * 30)

print(f"  联系人总数:{len(contacts)}")

print("=" * 30)

for name, info insorted(contacts.items()):

print(f"  {name}{info['phone']}")

print("=" * 30)

# 演示

add_contact("张三""13800138001")

add_contact("李四""13800138002")

add_contact("王五""13800138003")

list_all_contacts()

search_contact("张三")

delete_contact("王五")

list_all_contacts()

```

---

## 八、本节要点总结

| 数据结构 | 特点 | 适用场景 |

|---------|------|---------|

**列表** | 有序、可重复、可变 | 需要修改/排序/过滤的数据集合 |

**元组** | 有序、可重复、不可变 | 固定数据(如坐标、RGB颜色) |

**字典** | 键值对、键唯一、查找快 | 需要通过标识符查找数据 |

**集合** | 无序、不重复、支持集合运算 | 去重、交并差运算 |

---

## 九、练习题

### 练习 1:词频统计器

```python

text = "hello world hello python world hello"

words = text.split()

word_count = {}

for word in words:

    word_count[word] = word_count.get(word, 0) + 1

# 按出现次数降序排序

sorted_words = sorted(word_count.items(), key=lambdax: x[1], reverse=True)

for word, count in sorted_words:

print(f"{word}{count}次")

```

### 练习 2:矩阵转置

```python

matrix = [[123], [456], [789]]

transposed = [[matrix[row][col] for row inrange(len(matrix))]

for col inrange(len(matrix[0]))]

print(transposed)

# [[1, 4, 7], [2, 5, 8], [3, 6, 9]]

```

### 练习 3:去除列表中的重复项,保持顺序

```python

data = [31415926535]

seen = set()

unique = []

for item in data:

if item notin seen:

        seen.add(item)

        unique.append(item)

print(unique)  # [3, 1, 4, 5, 9, 2, 6]

```

### 练习 4:用字典模拟购物车

```python

cart = {}

products = {"苹果"5.0"香蕉"3.0"橙子"4.5"葡萄"8.0}

# 添加商品

cart["苹果"] = cart.get("苹果"0) + 2

cart["香蕉"] = cart.get("香蕉"0) + 3

# 计算总价

total = sum(products[item] * quantity for item, quantity in cart.items())

for item, quantity in cart.items():

print(f"{item}{quantity} x ¥{products[item]:.2f}")

print(f"总计: ¥{total:.2f}")

```

### 练习 5:简易学生成绩分析

```python

students = {

"张三": {"数学"95"英语"88"物理"92},

"李四": {"数学"78"英语"95"物理"85},

"王五": {"数学"90"英语"72"物理"95},

}

# 计算各科平均分

subjects = ["数学""英语""物理"]

for subject in subjects:

    scores = [student[subject] for student in students.values()]

    avg = sum(scores) / len(scores)

print(f"{subject}平均分: {avg:.1f}分")

# 找出总分最高的学生

for name, scores in students.items():

    total = sum(scores.values())

print(f"{name}总分: {total}")

```

---

## 下期预告

**Python 教程 Episode 03 — 面向对象编程**

- 类与对象:class、__init__、self

- 封装:属性与方法私有化

- 继承:子类与父类,super() 的使用

- 多态:不同类实现相同接口

- 魔术方法:__str____repr____len____eq__ 等

- 实战:构建一个简单的银行账户系统

---

*如果觉得本系列对你有帮助,欢迎点赞、评论、转发!有任何问题,在留言区讨论。*

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 08:27:41 HTTP/2.0 GET : https://f.mffb.com.cn/a/503152.html
  2. 运行时间 : 0.350582s [ 吞吐率:2.85req/s ] 内存消耗:4,782.63kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e81d4338b7c7af89841332418070e6a0
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.001062s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001729s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000800s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000671s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001352s ]
  6. SELECT * FROM `set` [ RunTime:0.000570s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001516s ]
  8. SELECT * FROM `article` WHERE `id` = 503152 LIMIT 1 [ RunTime:0.001587s ]
  9. UPDATE `article` SET `lasttime` = 1783038461 WHERE `id` = 503152 [ RunTime:0.028657s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.007495s ]
  11. SELECT * FROM `article` WHERE `id` < 503152 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.026238s ]
  12. SELECT * FROM `article` WHERE `id` > 503152 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.023241s ]
  13. SELECT * FROM `article` WHERE `id` < 503152 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.041343s ]
  14. SELECT * FROM `article` WHERE `id` < 503152 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.028206s ]
  15. SELECT * FROM `article` WHERE `id` < 503152 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.013137s ]
0.356224s