2021.9.27company_shenxinfu

1、查找两个文件中相同的IP地址

python代码:

// An highlighted block
with open("txt1","r") as f1:
	list1 = f1.readlines()
list1 = set(list1)
with open("txt2","r") as f2:
	list2 = f2.readlines()
list2 = set(list2)

same_data = list1.intersection(list2)
print(same_data)

for i in same_data:
	print(i.strip())

open和with open区别:
使用open打开文件,必须要使用close关闭文件,所以,为了保证无论是否出错都能正确地关闭文件。
with open可以不用close()方法关闭文件,无论在文件使用中遇到什么问题都能安全的退出,即使发生错误,退出运行时环境时也能安全退出文件并给出报错信息。
open和with open用法和区别: https://blog.csdn.net/hguisu/article/details/7880288.

2、有一个vector容器中,存有1亿个qq号(不重复),如何快速挑选出其中奇数号码?

(Hash)

3、从1亿个qq号中如何快速挑选出其中已经知道的一个号码?

海量数据处理算法—Bit-Map
Bit Map算法链接: https://blog.csdn.net/hguisu/article/details/7880288.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值