I have a certain file which contains data similar to the given format
Name : Neha xxxxx
Title : ENGINEER.xxxxx xxxxxx
Employee number : 27xxx
Status : Active
User ID : nehxxx
Manager ID : xxxx
Manager : Krisxxxxxxxx
This data is to be sequentially inserted into a database.For that purpose , i am first building lists by the following code
filename = "LDAPFile.txt"
lines = open(filename).read().splitlines()
#print lines
for item in lines:
if('Name') in item:
Name = item.split(':')[1]
#print Name[1]
if('Title') in item:
Title = item.split(":")[1]
#print Title[1]
if('Employee number') in item:
ENO = item.split(":")[1]
#print ENO
if('Status') in item:
Status = item.split(":")[1]
#print Status
if('User ID') in item:
UID = item.split(":")[1]
#print UID
if('Manager ID') in item:
MID = item.split(":")[1]
#print MID
#print len(MID)
if('Manager') in item:
MANAGER = item.split(":")
print MANAGER
#print len(MANAGER)
However , if('Manager') in item: results in both manager ID and Manager. How can I specifically search for Manager ?
if ('Manager :') in item? that should work if you don't assume "Manager:"