Re: [Tutor] Parsing txt file

2014-08-20 Thread Cameron Simpson
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  : *

Re: [Tutor] Parsing txt file

2014-08-20 Thread Danny Yoo
> 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

Re: [Tutor] Parsing txt file

2014-08-20 Thread Dave Angel
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

[Tutor] Parsing txt file

2014-08-20 Thread Dima Kulik
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

Re: [Tutor] parsing .txt

2008-06-10 Thread Kent Johnson
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

Re: [Tutor] parsing .txt

2008-06-10 Thread bob gailer
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

[Tutor] parsing .txt

2008-06-10 Thread glist
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