列表显示在中用户日志文件。你知道吗
我已经使用python从用户日志文件。你知道吗
SHRAMIK,STUDENT,CSE,34,
KESHAV,TEACHER,MECH,12
list = ['SHRAMIK,STUDENT,CSE,34', 'KESHAV,TEACHER,MECH,12']
search_value = "SHRAMIK"
我的代码:
with open('User.Log') as f:
lines = f.read().splitlines()
print(type(lines))
data = lines[0].split(",")
print("NEW LINES =============== >" ,lines)
print("NEW DATA =============== >" , data , "Roll No FROM LIST IS :", data[3])
我的输出:
('NEW LINES =============== >', ['SHRAMIK,STUDENT,CSE,34', 'KESHAV,TEACHER,MECH,12'])
('NEW DATA =============== >', ['SHRAMIK,STUDENT,CSE,34'], 'Roll No FROM LIST IS :', '34'
因此,我没有得到任何东西来使用Python搜索名称并检索关于名称的ROLL NO。你知道我该怎么解决这个问题吗?你知道吗
你就快到了-你把行拆分成了它的组件,现在你只需要比较名称和搜索值:
你能做到的。你知道吗
相关问题 更多 >
编程相关推荐