当前位置:网站首页>count registers in C code -- registers has one pattern
count registers in C code -- registers has one pattern
2022-06-22 05:24:00 【alex_mianmian】
#!/bin/python
import os
import re
words_dict={}
def grep_reg(key,path):
cmd="grep "+key+" -r "+path+" > alex.txt"
print cmd
os.system(cmd)
def match_reg(f,key):
reg_key = key+r"\.\w+"
reg_pattern = re.compile(reg_key)
for eachline in f:
print eachline
reg_list = reg_pattern.findall(eachline)
if reg_list:
print reg_list
reg_name = "".join(reg_list)
print reg_name
if reg_name in words_dict.keys():
words_dict[reg_name] +=1
else:
words_dict[reg_name] = 1
def print_reg():
for word,count in words_dict.items():
print('%-20s:' % word,count)
if __name__ == "__main__":
key=raw_input('please input reg key:')
path=raw_input('please input path:')
grep_reg(key,path)
f=open("alex.txt")
match_reg(f,key)
print_reg()
边栏推荐
- 2022 new test questions for tea specialists (primary) and summary of tea specialists (primary) examination
- DTS迁移秘籍-Oracle篇
- Detailed explanation of deep learning technology for building an image search engine that can find similar images
- Use keytool to access the JKS file get SSL certificate
- Rambbmitmq Push Party
- 冰河十年前的预测如今被阿里实现了,非常震撼
- 9. Gateway cross domain processing
- Does the air valve perform the en 1634-1 fire resistance test for 4 hours?
- P1318 ponding area
- 在Vs Code中搭建JSP开发环境
猜你喜欢

1108. Defanging an IP Address

Non recursive printing Fibonacci sequence

P1160 队列安排

关于背包问题的总结

Summary of knapsack problem

冰河十年前的预测如今被阿里实现了,非常震撼

In 2022, the third batch (principal) of Guangdong Provincial Safety Officer a certificate was found and analyzed, and the third batch (principal) of Guangdong Provincial Safety Officer a certificate w

使用keytool从.jks文件获取SSL certificate

部署SuperMap iServer war包时的服务迁移

2022 a special equipment related management (elevator) examination data and a special equipment related management (elevator) analysis
随机推荐
[cloud native] 2.2 kubeadm create cluster
DTS migration script sqlserver
Kubernetes - deploy application to cluster
Solve the shortage of developers. Maybe it can help you
【云原生】2.2 kubeadm创建集群
Detailed explanation of deep learning technology for building an image search engine that can find similar images
冰河十年前的预测如今被阿里实现了,非常震撼
Jedissentinel tool class
Conversion between JSON, string and map
Rambbmitmq consumer
C语言自定义函数的一些注意事项
6. Local - custom filter factory
P1061 [NOIP2006 普及组] Jam 的计数法
2022 Shenzhen Futian District specialized special new small giant enterprise application conditions, with a subsidy of 500000 yuan
7. Gateway global filter
Liunx virtual machine environment uses docker to install Oracle database and Navicat to connect
北京密云区知识产权贯标的好处,补贴5-10万
In 2022, the third batch (principal) of Guangdong Provincial Safety Officer a certificate was found and analyzed, and the third batch (principal) of Guangdong Provincial Safety Officer a certificate w
从JedisSentinelPool获取jedis
The postmanutils tool class simulates the get and post requests of postman