[英]how to search for a column value from excel in python
Sl No , Task , Date , Hrs Sl No,Task,Date,Hrs
1 ,Proxy bid new flow of accepting all the bids as proxy bid started,12-Nov-12, 8hrs 1,代理出价开始接受所有出价作为代理出价的新流程,12年11月12日,8小时
2 ,Proxy bid new flow of accepting all the bids as proxy bid completed in local machine,14-Nov-12 4hrs 2,接受所有出价作为代理出价的代理出价新流程在本地计算机上完成,12月11日至11月4日
3 ,Proxy bid new flow of accepting all the bids as proxy bid uploaded in test server and then in Live server and testing done,16-Nov-12 ,6hrs 3,接受所有投标作为代理投标的代理投标新流程,先将其上传到测试服务器中,然后再上传到实时服务器中,并完成测试,12月16日至11月6日
This is how my excel sheet looks like , Now I want to create a function in python which will take the input parameter of Date or also may be the Task and will return the Hrs. 这就是我的excel工作表的样子,现在我想在python中创建一个函数,该函数将使用Date的输入参数,或者也可以是Task并将返回Hrs。
Is it possible? 可能吗?
Thanks in advance. 提前致谢。
try with this code. 尝试使用此代码。 suppose f1.csv is the file. 假设f1.csv是文件。
import os
str1 = '"Proxy bid new flow of accepting all the bids as proxy bid started"'
def get_hours(str1):
cmd1 = 'grep -R '+str1 +' f.csv'
result = os.popen(cmd1).read()
hrs = result.split(',')[-1]
print hrs
return hrs
get_hours(str1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.