python学习第一天

今天学习了一下python,主要是作了两个例子,总结了一下涉及到的概念。

先把写的例子放上来

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
import re,string
	is_all=[]#吧日志一条条分割
	is_only={}#只有session和ip,用字典
	is_fina={}#最后的结果

	def is_find():#主要是用来得到is_all
		f=open('D:\\doc\\serachlog.txt','r')
		temp=f.readlines()
		for line in temp:
			is_all.append(re.split('\s\s+|\t|,',line.strip()))
	def is_list(ip_all):
		for i in range(len(ip_all)):
			is_only[ip_all[i][1]]=is_only[i][2]
	def is_select(ip_only):
		count=0
		for values in ip_only.values():
			for eachkey in ip_only.keys():
				if values==ip_only[eachkey]:
					count=count+1
			is_final[values]=count
			count=0
			
 

转载于:https://www.cnblogs.com/lhbssc/archive/2012/03/27/2420001.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值