python字典去重脚本
#!/usr/bin/env python
# encoding: utf-8 #字典去重小代码
import sys
import os
import platform
try:
pass
except:
print '''you have something wrong this is a simple jiaoben '''
sys.exit() why = 'why.txt'
for i in xrange(len(sys.argv)):
if(i>=1):
other = sys.argv[i]
if os.path.exists(other):
pass
else:
print other + ' file not find'
sys.exit()
if 'Windows' in platform.system():
os.system("type "+other+" >> "+why)
else:
os.system("cat "+other+" >> "+why) yuan = open('why.txt','r')
dirc = open('whynot.txt','w')
for line in set(yuan.readlines()):
if line == '' or line == '\r\n':
pass
else:
dirc.writelines(line)
很简单的思路 把文件放入到why.txt中 然后再去重得到whynot.txt
Usage: quchong.py 1.txt 2.txt 3.txt 等等
python字典去重脚本的更多相关文章
- python字典去重
今天实习的web大表哥说帮我看环境不过前提是要我帮他写个python合并列表的demo, 大概思路就是利用zip库进行keys和values的遍历,然后在输出就行 key1={'name1':'小明' ...
- python编写shell脚本详细讲解
python编写shell脚本详细讲解 那,python可以做shell脚本吗? 首先介绍一个函数: os.system(command) 这个函数可以调用shell运行命令行command并且返回它 ...
- 用 Python 替代 Bash 脚本(转)
add by zhj: 其实作者是想说用Python来做那些Bash实现起来比较麻烦的部分,即将Bash与Python结合使用. 英文原文:http://www.linuxjournal.com/co ...
- [FUZZ]文件上传fuzz字典生成脚本—使用方法
文件上传fuzz字典生成脚本-使用方法 原作者:c0ny1 项目地址:https://github.com/c0ny1/upload-fuzz-dic-builder 项目预览效果图: 帮助手册: 脚 ...
- 文件上传漏洞fuzz字典生成脚本小工具分享
前言 学习xss的时候翻阅资料发现了一个文件上传漏洞fuzz字典生成脚本小工具,试了试还不错,分享一下 配置 需要python2环境 工具地址:https://github.com/c0ny1/upl ...
- python注释、脚本参数、字节码
python注释.脚本参数.字节码 --道心 python安装 1.下载安装包 https://www.python.org/downloads/ 2.安装 默认安装路径:C:\python27 3. ...
- Python数据库备份脚本
Python数据库备份脚本 #!/usr/bin/env python # author: liudong # -*- coding: utf-8 -*- # filename: db_bak.py ...
- Python字典和集合
Python字典操作与遍历: 1.http://www.cnblogs.com/rubylouvre/archive/2011/06/19/2084739.html 2.http://5iqiong. ...
- python 字典排序 关于sort()、reversed()、sorted()
一.Python的排序 1.reversed() 这个很好理解,reversed英文意思就是:adj. 颠倒的:相反的:(判决等)撤销的 print list(reversed(['dream','a ...
随机推荐
- swiper在vue中的使用 及 神坑
一.实例化和导入 import Swiper from 'swiper'; let viewSwiper; let previewSwiper; 在外面声明全局变量,然后在初始化方法里面实例化swip ...
- web前端--实现前后端分离的心得
1.实现前后端分离的心得 2.前后端分离实践 3.谈谈前后端的分工协作 4.从MVC到前后端分离(REST-个人也认为是目前比较流行和比较好的方式) 4.1.REST风格框架实战:从MVC到前后端分离 ...
- [转]9.2.3 .net core 通过TagHelper封装控件
本文转自:https://www.cnblogs.com/BenDan2002/p/6170624.html .net core 除了继续保留.net framework的HtmlHelper的写法以 ...
- jQuery操作<input type="radio">
input type="radio">如下: <input type="radio" name="city" value=&qu ...
- videojs IE8无法播放解决方案
1.如果是在.cs文件里初始化视频元素,没有遇到无法播放问题. 2.如果是js动态换播放器的poster和src遇到此问题,解决办法是用videojs提供的函数来设置 https://github.c ...
- 设置TableView section header的颜色
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInte ...
- python之线程queue
线程queue介绍 Queue的种类: FIFO: Queue.Queue(maxsize=0) FIFO即First in First Out,先进先出.Queue提供了一个基本的FIFO容器,使 ...
- 浅谈一致性哈希(My转)
一致性哈希(Consistent hashing)算法是由 MIT 的Karger 等人与1997年在一篇学术论文(<Consistent hashing and random trees: d ...
- Qt程序Release版出现 类似 QEventLoop: Cannot be used without QApplication 问题的终极解决方案
最近在做Qt程序开发,程序在Debug下跑是没有问题的,发布到Release版本后,出现各种问题: 报各种莫名其妙的错误,类似的错误有: QEventLoop:Cannot be used wit ...
- charles 抓包 https 证书
1. 概述 环境:这里是windows8 和 android (参考了ios环境的博客) 手机app点击发出http及https的请求,之前抓包都有请求的相关内容展示,这次没有,原来之前的一直抓的是h ...