Python
cbirer
这个作者很懒,什么都没留下…
展开
-
Queue (Linked & Sequential) in Python
@[TOC](Queue (Linked & Sequential) in Python) 1. Node class Node: def __init__(self, data): self.data = data self.next = None def __eq__(self, data): return self.data == data def __str__(self): return str(s原创 2021-02-27 02:27:01 · 141 阅读 · 0 评论 -
Linked Stack in Python
Linked Stack in Python1. Node2. Stack3. Test Codes 1. Node class Node: def __init__(self, data): self.data = data self.next = None def __str__(self): return str(self.data) 2. Stack class Stack: def __init__(self):原创 2021-02-26 23:51:01 · 134 阅读 · 0 评论 -
Circular Linked List in Python
Circular Linked List in Python1. Node2. Circular Linked List3. Test Codes 1. Node class Node: def __init__(self, data): self.data = data self.next = None def __eq__(self, data): return self.data == data def __str__原创 2021-02-26 15:41:01 · 170 阅读 · 0 评论 -
Doubly Linked List in Python
Doubly Linked List in Python1. 结点定义2. 双向链表的实现3. 测试程序 1. 结点定义 class Node: def __init__(self, data): self.data = data self.prev = None self.next = None def __eq__(self, data): return self.data == data def __str__原创 2021-02-26 15:36:09 · 145 阅读 · 0 评论 -
Singly Linked List in Python
单链表的Python语言实现1. 结点定义2. 单链表实现3. 测试程序 1. 结点定义 class Node: def __init__(self, data): self.data = data self.next = None def __str__(self): return str(self.data) 2. 单链表实现 class SinglyLinkedList: def __init__(self):原创 2021-02-26 15:27:51 · 198 阅读 · 0 评论 -
Notes on Python Debugger pdb
Python comes with its own debugger module — pdb. You can set breakpoints, step through your code, inspect stack frames and more.How to Start the DebuggerImport pdb and insert pdb.set_trace() into your原创 2016-11-20 23:43:28 · 269 阅读 · 0 评论 -
Some Basic Knowledge Points of Python Programming
if __name__ == "__main__":# do sth.This tells Python that you only what to run the following code if this program is executed as a standalone file. We can use it to test our code.When you do import a m原创 2016-11-20 01:04:03 · 240 阅读 · 0 评论 -
Notes on Exception Handling in Python
Note: error and exception are the same in Python.Common Exception Exception Almost all the others are built off of it. AttributeError Raised when an attribute reference or assignment fails. IOError Rai原创 2016-11-20 00:20:36 · 312 阅读 · 0 评论 -
Note on Python File Operation
How to Read Files Piece by Pieceh = open('test.txt', 'r') for line in h: print(h) h.close()h = open('test.txt', 'r') while True: data = h.read(1024) print(data) if not data: bre原创 2016-11-19 23:25:09 · 365 阅读 · 0 评论 -
Notes on Python Comprehensions
List Comprehensionsx = [i for i in range(10)]if [i for i in line if "SOME TERM" in i]: # do somethingx = ['1', '2', '3', '4', '5'] y = [int(i) for i in x]my_strs = [s.strip() for s in str_list]vec原创 2016-11-18 23:56:46 · 239 阅读 · 0 评论