- 博客(13)
- 资源 (3)
- 收藏
- 关注
原创 队列(循环队列、链队列)
循环队列: // cirQueue.h /* 名称:循环队列 => 基于数组 */ template<class DataType> class CirQueue { private: const int QUEUE_SIZE; // 此处未给初始值,则必需在构造函数中初始化! int front, rear; DataType *queue; public: CirQueue(int q_size = 100) :QUEUE_SIZE(q_size + 1) { fron
2020-07-27 00:37:29
239
原创 栈(顺序栈、链栈)
顺序栈: // seqStack.h // 顺序栈 template<class DataType> class SeqStack { private: const int STACK_SIZE; DataType *stack; int top; //栈顶 public: SeqStack(int stack_size = 10) :STACK_SIZE(stack_size) { top = -1; stack = new DataType[STACK_SIZE]; } ~S
2020-07-27 00:34:44
188
原创 双向链表
双向链表的基本实现: // doubly.cpp #include<iostream> using namespace std; /*此部分可写在.h文件中*/ template<class DataType> struct Node { DataType data; Node<DataType>* prior, *next; }; template<class DataType> class LinkList { private: Node&l
2020-07-27 00:30:36
182
原创 单链表
单链表功能的基本实现: // singly.cpp #include<iostream> using namespace std; /*此部分可写在.h文件中*/ template<class DataType> struct Node { DataType data; Node<DataType>* next; }; template<class DataType> class LinkList { private: Node<DataT
2020-07-27 00:28:36
162
原创 python文件处理
1、csv文件读写: import csv # 系统自带的模块 class CsvHandle(): '''csv文件的 读写操作''' demo_lists = [[1,2,3], [4,5,6], [7,8,9]] def csvReader(self, read_file_path): # read_file_path ==> xxx.csv ...
2020-03-28 15:59:56
156
原创 python3面试 | 必掌握的知识点
1、类可以添加一个自定义的内置函数吗? 答:不可以。内置函数是Python解释器的一部分,要阉割控制其数量。(但是可以重写内置函数) 2、多继承时,构造方法的调用情况? 答:根据MRO列表进行调用。具体原则如下: 2.1 子类永远在父类前面; 2.2 若多个父类中存在相同的方法,则调用第一个父类的方法。 class Base(object): def __init__(sel...
2020-03-26 22:13:15
297
原创 python读取csv文件内容(中文)报错:UnicodeDecodeError
UnicodeDecodeError:'utf-8' codec can't decode byte 0xd4 in position 16: invalid continuation byte 原因:文本的编码与解码问题。此处说明已经超出了utf-8的表示范围了。 解决方案: 1、改用‘gbk’的编码方法读取文件内容。 # 注意:指定了encoding='gbk'。一般采用gbk编码能...
2020-03-25 23:43:29
1518
原创 psycopg2模块 | python操作postgrel的模块
1、安装 # windows下: pip install psycopg2 # linux下: # 1、存在psycopg2 pip install psycopg2 # 2、不存在psycopg2 pip install psycopg2-binary 2、数据库操作 # 2.1 数据库连接 import psycopg2 conn = psycopg2.connect(datab...
2020-03-25 23:27:33
612
1
原创 python高级应用100例
一、推导式 1、列表推导式:求[1, 2, 3, 4, 5, 6]中的元素大于3的数的平方。 _list = [ a * a for a in [1,2,3,4,5,6] if a > 3] 2、集合推导式:去除[1, 2, 3, 4, 2, 3, 5, 6, 4]中的重复且无法整除2的元素。 _list =[1, 2, 3, 4, 2, 3, 5, 6, 4] 3、字...
2020-02-02 17:47:18
2187
1
原创 python操作技巧(一)
1、读取文件:去除空行,'\n' # splitlines():去除str中的'\n' with open('assets/cityCode.txt', 'r') as f: all_lines = [line for line in f.read().splitlines() if line]
2020-02-02 17:44:26
173
原创 centos7 uwsgi nginx 部署 python3.6 + django2.2
前言:规范本人习惯,一般不再root账号下进行配置。 1、创建一个管理项目的用户 useradd -U uwsgi # 创建与用户同名的组 passwd uwsgi # 切换到新用户下 su uwsgi 2、将项目放到/home/www/下(创建一个新的django项目参考官网) 提示:/home/www/ 只是推荐地址。可任意存放,只要在配置uwsgi.ini关联到即可。 #...
2020-01-20 23:04:45
400
原创 centos7上PostgreSQL11安装与配置
1、安装epel yum -y install epel-release 2、安装PostgreSQL11 yum -y install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm yum -y install postgresql1...
2020-01-12 17:25:22
547
cityCode.txt
2020-01-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅