Re: plain text parsing to html (newbie problem)

2009-12-11 Thread João
Lie Ryan wrote: > You can set MIME type and encoding from the MIME constructor > email.mime.Text.MIMEText("Bold Text", "html", "utf-8") > > are you importing "import mime" or "import email.mime" or "import > email.MIMEMultipart"? Hi Lie. I was importing as, 'from email.mime.text import MIMEText'

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread Lie Ryan
On 12/11/2009 8:43 PM, João wrote: On Dec 10, 7:55 pm, Lie Ryan wrote: and, is there any reason why you're not using the email and smtplib?http://docs.python.org/library/email-examples.html Mainly because I was unaware of them :( I just read about them and I found all the Subject, From, To

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread João
On Dec 10, 7:55 pm, Lie Ryan wrote: > > and, is there any reason why you're not using the email and > smtplib?http://docs.python.org/library/email-examples.html Mainly because I was unaware of them :( I just read about them and I found all the Subject, From, To classes, but what about Content-T

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread João
On Dec 10, 7:55 pm, Lie Ryan wrote: > > and, is there any reason why you're not using the email and > smtplib?http://docs.python.org/library/email-examples.html Mainly because I was unaware of them :( I just read about them and I found all the Subject, From, To classes, but what about Content-T

Re: plain text parsing to html (newbie problem)

2009-12-10 Thread Lie Ryan
On 12/10/2009 11:17 PM, João wrote: Thanks for the output. akean, I've installed ipython and I'm exploring it. Thanks. Terry, from what I've read stringIO allows us to store strings in a 'virtual' file. Can you please write just 2 lines exemplifying a write to and a read from an OS level file?

Re: plain text parsing to html (newbie problem)

2009-12-10 Thread João
Thanks for the output. akean, I've installed ipython and I'm exploring it. Thanks. Terry, from what I've read stringIO allows us to store strings in a 'virtual' file. Can you please write just 2 lines exemplifying a write to and a read from an OS level file? MRAB, that 'mail' object should've bee

Re: plain text parsing to html (newbie problem)

2009-12-10 Thread João
Thanks for the output. akean, I've installed ipython and I'm exploring it. Thanks. Terry, from what I've read stringIO allows us to store strings in a 'virtual' file. Can you please write just 2 lines exemplifying a write to and a read from an OS level file? MRAB, that 'mail' object should've bee

Re: plain text parsing to html (newbie problem)

2009-12-09 Thread akean
On Dec 10, 3:59 am, João wrote: > I apologize for my newbiness but I'm banging my head making this work : > ( ... > How can I see the output run in debug mode like in perl? > One method: install ipython (another python shell, but with some useful extra features) and then run the program inside

Re: plain text parsing to html (newbie problem)

2009-12-09 Thread Terry Reedy
João wrote: I apologize for my newbiness but I'm banging my head making this work : ( What change must I made for the tag enforcement being reflected to the 'mail' file? Am I using the WritableObject class correctly? (I'm getting a blank 'mail' file after running the .py script) How can I see the

Re: plain text parsing to html (newbie problem)

2009-12-09 Thread MRAB
João wrote: I apologize for my newbiness but I'm banging my head making this work : ( What change must I made for the tag enforcement being reflected to the 'mail' file? Am I using the WritableObject class correctly? (I'm getting a blank 'mail' file after running the .py script) How can I see the

plain text parsing to html (newbie problem)

2009-12-09 Thread João
I apologize for my newbiness but I'm banging my head making this work : ( What change must I made for the tag enforcement being reflected to the 'mail' file? Am I using the WritableObject class correctly? (I'm getting a blank 'mail' file after running the .py script) How can I see the output run in

Re: Text parsing via regex

2008-12-09 Thread rdmurray
On Mon, 8 Dec 2008 at 16:51, Robert Kern wrote: Robocop wrote: Wow! Thanks for all the input, it looks like that textwrapper will work great for my needs. And thanks for the regex help everyone. Also, i was thinking of using a list, but i haven't used them much in python. Is there anythin

Re: Text parsing via regex

2008-12-08 Thread Robert Kern
Robocop wrote: Wow! Thanks for all the input, it looks like that textwrapper will work great for my needs. And thanks for the regex help everyone. Also, i was thinking of using a list, but i haven't used them much in python. Is there anything in python that is equivalent to pushback in c++ for

Re: Text parsing via regex

2008-12-08 Thread Robocop
Wow! Thanks for all the input, it looks like that textwrapper will work great for my needs. And thanks for the regex help everyone. Also, i was thinking of using a list, but i haven't used them much in python. Is there anything in python that is equivalent to pushback in c++ for vectors? As in,

Re: Text parsing via regex

2008-12-08 Thread MRAB
Vlastimil Brom wrote: 2008/12/8 Robocop <[EMAIL PROTECTED]>: I'm having a little text parsing problem that i think would be really quick to troubleshoot for someone more versed in python and Regexes. I need to write a simple script that parses some arbitrarily long string every 50

Re: Text parsing via regex

2008-12-08 Thread MRAB
Paul McGuire wrote: On Dec 8, 12:13 pm, Robocop <[EMAIL PROTECTED]> wrote: I'm having a little text parsing problem that i think would be really quick to troubleshoot for someone more versed in python and Regexes. I need to write a simple script that parses some arbitrarily long stri

Re: Text parsing via regex

2008-12-08 Thread Vlastimil Brom
2008/12/8 Robocop <[EMAIL PROTECTED]>: > I'm having a little text parsing problem that i think would be really > quick to troubleshoot for someone more versed in python and Regexes. > I need to write a simple script that parses some arbitrarily long > string every 50 charact

Re: Text parsing via regex

2008-12-08 Thread Shane Geiger
uot;"" # example: make it fit in 40 columns print(wrap(msg,40)) # result is below """ Arthur: "The Lady of the Lake, her arm """ Robocop wrote: I'm having a little text parsing problem that i think would be really quick to troubleshoot for some

Re: Text parsing via regex

2008-12-08 Thread I V
On Mon, 08 Dec 2008 13:42:00 -0500, r0g wrote: > Robocop wrote: >> However i'm having several problems. I know that playskool regular >> expression i wrote above will only parse every 50 characters, and will >> blindly cut words in half if the parsed string doesn't end with a >> whitespace. I'm r

Re: Text parsing via regex

2008-12-08 Thread Paul McGuire
On Dec 8, 12:13 pm, Robocop <[EMAIL PROTECTED]> wrote: > I'm having a little text parsing problem that i think would be really > quick to troubleshoot for someone more versed in python and Regexes. > I need to write a simple script that parses some arbitrarily long > str

Re: Text parsing via regex

2008-12-08 Thread r0g
Robocop wrote: > I'm having a little text parsing problem that i think would be really > quick to troubleshoot for someone more versed in python and Regexes. > I need to write a simple script that parses some arbitrarily long > string every 50 characters, and does not parse text

Text parsing via regex

2008-12-08 Thread Robocop
I'm having a little text parsing problem that i think would be really quick to troubleshoot for someone more versed in python and Regexes. I need to write a simple script that parses some arbitrarily long string every 50 characters, and does not parse text in the middle of words (but ultim

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Thanks all. I think I'll follow the "don't do that" advice. jr Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread John Machin
Tim Hochberg wrote: [snip] > I agree that mixing the line assembly and parsing is probably a mistake > although using next explicitly is fine as long as your careful with it. > For instance, I would be wary to use the mixed for-loop, next strategy > that some of the previous posts suggested. Here'

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Tim Hochberg
John Machin wrote: > Jacob Rael wrote: >> Hello, >> >> I have a simple script to parse a text file (a visual basic program) >> and convert key parts to tcl. Since I am only working on specific >> sections and I need it quick, I decided not to learn/try a full blown >> parsing module. My simple scri

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread John Machin
Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full blown > parsing module. My simple script works well until it runs

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Roberto Bonvallet
Jacob Rael wrote: [...] > I would line to identify if a line continues (if line.endswith('_')) > and concate with the next line: > > line = line + nextLine > > How can I get the next line when I am in a for loop using readlines? Don't use readlines. # NOT TESTED program = open(fileName)

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Larry Bates
Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full blown > parsing module. My simple script works well until it run

Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to learn/try a full blown parsing module. My simple script works well until it runs into functions that straddle

Re: command text parsing and hints displaying on user input.

2006-10-17 Thread Kent Johnson
Andy wrote: > Hi guys, > > I'm writing a program with a feature of accepting user input as command > text and parsing it to correct function calls...example: > > "5 minutes later"/"5 min later"/"5 minute later"/"after 5 minutes"... > are being parsed as the same rule so the system will call a lat

Re: command text parsing and hints displaying on user input.

2006-10-16 Thread Andy
Anybody have an idea on this?? Does Natural Language Processing help in this case? -- http://mail.python.org/mailman/listinfo/python-list

command text parsing and hints displaying on user input.

2006-10-16 Thread Andy
ystem will call a later function with minutes=5 as parameter. Of course there are many other possiblilities, "seconds"/"days", and even "every(each) hour"/"every Monday"/"every two days"...so on... The datetime computation can be done with the wond

Re: Text parsing

2006-08-20 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Michiel Sikma wrote: > My code: > > test.py > import sys > > def preparse(file): > block = [] > for line in file: > if line.strip(): > block.append(line) > elif block: > yi

Text parsing

2006-08-20 Thread Michiel Sikma
Hello everybody. Inspired by an example from the book Beginning Python: From Novice to Professional, I started working on a simple text parser which I can hopefully then extend into a more comprehensive system. I've got a little problem, though. My code: test.py import sys