On 20Aug2014 16:35, Dima Kulik wrote:
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 : *
> 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
Dima Kulik Wrote in message:
Please post in text mode. The html mode you used can cause
multiple problems.
Please specify your Python version and os version in any new
thread.It sometimes makes a big difference in the
solution.
Your primary problem is that you don't close the files.
But yo
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
ObjectGUI
On Tue, Jun 10, 2008 at 7:45 AM, bob gailer <[EMAIL PROTECTED]> wrote:
> questionary = []
>
> for line in textdata.split('\n'):
> if line:
> tag, content = line.split(' ', 1)
tag = tag[1:] # strip leading %
> if tag == "question":
> questionary.append({tag : content
glist wrote:
Let's say I have a file with this kind of content/lines
textdata = '''
%question What is Python?
%correct A programming language
%wrong A graphical package
%wrong An operating system
%question Is Computer Science really about computers?
%wrong Yes
%correct No
'''
I want to pose th
Let's say I have a file with this kind of content/lines
textdata = '''
%question What is Python?
%correct A programming language
%wrong A graphical package
%wrong An operating system
%question Is Computer Science really about computers?
%wrong Yes
%correct No
'''
I want to pose the question to a