- 博客(13)
- 收藏
- 关注
原创 C++ assign()函数的简单使用
#include <iostream>#include <string>#include <vector>#include <list>using namespace std;void assign_use(){ char *ac[] = {"liu","yu","dong","xiao","fa"
2018-05-29 15:20:11 8817
原创 C++ 提取、整理数据的工具
#include <iostream>#include <fstream>#include <vector>#include <string>#include <map>#include <assert.h>#include <io.h>#include <windows.h> #in
2018-05-18 16:27:55 680
原创 C++ 整理txt文件的小工具 对文件格式处理
#include <iostream>#include <fstream>#include <vector>#include <string>#include <map>using namespace std;const int ID_SIZE=5;//根据相应的模式进行选择struct DADE{ vector<string>...
2018-05-17 13:25:54 503
原创 C++整理大数据文件vector
#include <iostream>#include <fstream>#include <string>#include <vector>#include <map>struct MyDate{ string str1; string str2;// string str3;};int strGetDate(){ ifstream f...
2018-05-16 16:59:11 480
原创 C++ 读、写、整理大数据到新文件
#include <iostream>#include <fstream>#include <string>#include <vector>#include <map>using namespace std;const int ID_SIZE = 2;//对处理当前文本库中的ID的位数定义,test.txt中使用5个byte。struc...
2018-05-16 16:57:26 1214
原创 Python 删除文件和文件名特定字符
#coding=utf-8import osimport stringdef re_file(): path = os.getcwd() #filelist = os.listdir(path) #该文件夹下所有的文件(包括文件夹) for root, dirs,files in os.walk(path): for name in files: #遍历所有文件 pathname = os...
2018-05-15 10:40:58 6332
原创 Python 修改文件夹下所有文件指定字符串
def re_name(): path="E:\\XML" filelist = os.listdir(path) #该文件夹下所有的文件(包括文件夹) for files in filelist: #遍历所有文件 pos = files.find(".tab.out") if (pos == -1): continue ne...
2018-05-14 17:21:51 518
原创 Python 查找某个目录下面的文件个文件夹(递归)os.walk方法
import osimport fnmatchdef all_files(root, patterns= '*', single_level = False, yield_folders = False): patterns = patterns.split(';') for path, subdirs,files in os.walk(root): if yield_f...
2018-05-09 14:17:29 1484
原创 Python 移动光标位置
x = file('1.txt','r')print x.tell() #显示当前光标位置x.seek(3)print x.tell() #没有设置光标位置,默认从头开始移动3个位置x.seek(5, 1)print x.tell() #从当前开始移动5个位置x.seek(2, 2)print x.tell() #从末尾开始向前移动2个位置...
2018-05-09 10:37:28 13017
原创 去掉字符串中的空格
s1 = " fdsf dsffsdf "print s1.lstrip() #去掉左边的空格s2 = " edsfsdf dsf "print s2.rstrip() #去掉右边的空格s3 = " dsfdsaf sdfd sdsf "print s3.strip() #去掉两边的空格s4 = " dsfdsaf sdfd sdsf "print s4.replace(' ', ...
2018-05-09 10:33:14 186
原创 linecache读取大文件
# coding=utf-8import osimport linecachedef get_content(path): '''读取缓存中文件内容,以字符串形式返回''' if os.path.exists(path): content = '' cache_data = linecache.getlines(path) for line i...
2018-05-09 10:11:57 494
原创 Python完全平方数,编程练习题实例三
题目:一个整数,它加上100 后是一个完全平方数,再加上168 又是一个完全平方数,请问该数是多少?import mathfor i in range(1, 10001): x = int(math.sqrt(i + 100)) #转化为整型值 y = int(math.sqrt(i + 268)) #转化为整型值 if (x * x) == (i + 100) a...
2018-05-02 15:53:04 1106 1
原创 Python数轴编程练习题实例二
题目:企业发放的奖金根据利润提成。利润(I) :低于或等于10 万元时,奖金可提10%;高于10 万元,低于20 万元时,低于10 万元的部分按10%提成,高于10万元的部分,可提成7.5%;20 万到40 万之间时,高于20 万元的部分,可提成5%;40 万到60 万之间时,高于40 万元的部分,可提成3%;60 万到100 万之间时,高于60 万元的部分,可提成1.5%,高于100 万元时,超...
2018-05-02 14:28:45 1533 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人