Hi to all. I have a problem with parsing file.
I have txt file exported from AD and it has such structure: 

DistinguishedName : CN=*** ,OU=*** ,OU=*** ,DC=*** ,DC=***,DC=***
GroupCategory     : Distribution
GroupScope        : Universal
Name              : ****
ObjectClass       : group
ObjectGUID        : 0b74b4e2-aad1-4342-a8f4-2fa7763e1d49
SamAccountName    : ****
SID               : S-1-5-21-1801674531-492894223-839522115-16421


i need to export to file all stings which start from "Name"

I've tried to make little parser:

keywords = ['Name', 'Name:']
input_file=open("Mail_Groups.txt","r").readlines()
output_file=open("Out.txt","w")
for line in input_file:
    for word in line.split():
        if word in keywords:
            output_file.write(line)

but the output is clear.

What the problem is? Can some one help me?
-- 
Dima Kulik
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to