文件I/O之C标准库函数和系统库函数区别 首先C标准库函数是工作在系统库函数之上的。C标准库函数在读写文件时候都有一个文件流指针。FILE*fp=NULL;// fp=fopen(F_PATH,"r");fp文件流指针,其指向结构体如下图所示。文件描述符指向磁盘文件,在进行文件读写操作时候是先读写到缓冲区,然后再调用系统应用层API write函数进行写操作,write将文件内容写到内核缓冲区,然后再调用内核层API ...
lxml与bs4 select、58爬虫实例 基础班```#coding=utf8from future import unicode_literalsfrom bs4 import BeautifulSoupimport requestsheaders={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML...
BeautifulSoup检索多级标签 对于这样的多级标签<li class="l_reply_num" style="margin-left:8px"> <span class="red" style="margin-right:3px">4790</span>回复贴,共 <span class="red">36</span>页</li&...
memcmp 、memchr实现 内容memcmp、memicmp原型对比memicmp实现memchr实现memcmp函数原型:extern int memcmp(void str1, void str2, unsigned int n)参数说明:str1和str2为指定作比较的字符串,比较两个字符串的前n个字节。memcmp函数实现的是字节的比较,而不是字符的比较。memicmp函...
linux基础学习、vim操作 ctrl+shift+t:打开终端vim分屏:末行模式:sp分上下两屏,wsp分左右两屏,ctrl+ww在两屏间切换x删除一个字符r替换一个字符gcc命令:gcc编译信息:gcc main.c -o maingcc编译信息时指定头文件在什么目录:gcc -I./code main.c -o main-c 只编译,生成.o文件,不进行链接-g 包含调试信息-On n=...
itoa 、atoi 字符串与整数之间的转换 文档内容itoa、atoizhuanhftoaatof#include <stdio.h>#include <stdlib.h>#include <string.h>int myatoi(char *str){ char *istr = str; while (*istr!='\0')//遍历每一个字符 ...
memory系列函数对比以及实现 文档内容:memcpy、memmove、memccpy说明、比较memcpy(拷贝)实现memset(设置值)实现memmove(拷贝)实现memccpy(拷贝,遇到设定值终止拷贝)实现memcpy()、 memmove()和memccpy()这三个函数的功能均是将某个内存块复制到另一个内存块。前两个函数的区别在于它们处理内存区域重叠(overlapping...
异步加载网站爬虫 from bs4 import BeautifulSoupimport requestsimport timeheaders={ 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/5...
爬虫学习笔记 Requests基础发送请求所有requests请求均返回response对象requests.get(url) 通过get方式发送请求参数可以通过url+?+key=value&…方式添加也可以dict={key:value},requests.get(url,params=dict)方式添加requests.post(url) 通过post方式发送请求参...
一维及多维动态数组初始化及遍历 #include <stdio.h>#include <stdlib.h>void show1(){ int *p = malloc(sizeof(int)* 10); printf("%p", p); for (int i = 0; i < 10;i++) { printf("%9d", p[i...
动态分配字符串数组指针以及排序查找 #define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#include <string.h>int num;//代表多少个指针,每个指针对应一个字符串void main1(){ //char *p[10] = { "1123", "1231" };...
Requests库学习 请求豆瓣电影的前250,然后获取请求到内容的属性 import requests r = requests.get('https://movie.douban.com/top250') print type(r) print r.status_code print r.encoding #print r.text print r.cookiesreque...
字符串实战 能去除空格和计算小数的加减法#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#include <iostream>using namespace std;//void eatspace(char *str)//{// int i = 0;/...
锯齿数组 #include <stdio.h> #include <stdlib.h> #define N 10 //N *开辟 N-1*的数组 void main() { //int *p = malloc(sizeof(int)*N);//p[5] int **pp = malloc(siz...
字符串 目录:* 字符串基础知识* 字符串指针指向的内存只可读不可写* 字符串指针存储的是首地址,输出中文字符需设定中文环境* 字符串拷贝strcpy* 计算长度函数实现strlen* 检索字符串函数strstr* 排序函数qsort* 比较两个字符串是否相等strcmp* 将一个串中的所有字符都设为指定字符strcat* 查找字符串s中首次出现字符c的位置strchr(s...
c语言操作数据库 #include <stdio.h> #include <stdlib.h> #include "sqlite3.h" char path[100] = "C:\\Users\\yincheng01\\Desktop\\1.db"; void main() { sqlite...
密码库 #define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>void main1(){ char str[10] = "111111"; for (char*p = str; *p != '\0';p++)//*p != '\0' { p...
堆排序 #include <stdio.h> #include <stdlib.h> //堆排序,查找最大值,最小值速度最快 //取最大值,取最小值怎么写 //大顶堆,小顶堆。 void show(int *p, int n) { for (int i = 0; i ...
函数与指针 void (*p)()=0x10510b9;//函数指针,地址为要调用函数的地址p();//调用函数指针变量,在数据区,但是存储了代码区的地址,函数在代码区int (*p)[5]; 指向数组的指针,占四个字节int *p[5];是一个数组,每一个元素是一个指针栈分配内存int *p=alloca(sizeof(int)* 10);alloca分配内存后自动释放内存函...
快速排序 #include <stdio.h>#include<stdlib.h>void swap(int * pi,int *pj)//交换{ int temp = *pi; *pi = *pj; *pj = temp;}void show(int *p,int n)//显示数组状态{ printf("此时状态 "...