Re: [Tutor] Script Feedback

2010-03-31 Thread Steven D'Aprano
On Wed, 31 Mar 2010 10:54:34 am Damon Timm wrote: > > Separate the underlying functionality from the application-level > > code. These functions should NEVER print anything: they do all > > communication through call-backs, or by returning a value, or > > raising an exception. > > I tried to imple

Re: [Tutor] Open a WebPage with Forms Authentication

2010-03-31 Thread Shashwat Anand
may be you can try mechanize ? On Thu, Apr 1, 2010 at 3:41 AM, GoodPotatoes wrote: > I would like to sign onto a web page, but am having a difficult time > determine what parameters to pass in my sign in. For a simple test, I am > trying to parse text on a "friends" status page on twitter. Thi

Re: [Tutor] what's wrong in my command?

2010-03-31 Thread bob gailer
On 3/31/2010 4:33 PM, Shurui Liu (Aaron Liu) wrote: # geek_translator3.py # Pickle import pickle # Open Dictionary geekfile = open('geekdictionary3.txt', 'r+') new_geeks = pickle.load(geekfile) geekterms = new_geeks.keys() geekterms.sort() # start choice = None while choice != "0": print

[Tutor] Open a WebPage with Forms Authentication

2010-03-31 Thread GoodPotatoes
I would like to sign onto a web page, but am having a difficult time determine what parameters to pass in my sign in. For a simple test, I am trying to parse text on a "friends" status page on twitter. This is not via the API, but the web. import urllib2, urllib, cookielib opener = urllib2.bu

Re: [Tutor] simple search and replace...

2010-03-31 Thread Spencer Parker
I was on the right track...looking more for advice than anything. Regex could get too complicated for what I am doing. I also maintain the list in a different config file because it does change from time to time...we add and delete depending on what we are doing. Something like this adds a lot m

[Tutor] what's wrong in my command?

2010-03-31 Thread Shurui Liu (Aaron Liu)
# geek_translator3.py # Pickle import pickle # Open Dictionary geekfile = open('geekdictionary3.txt', 'r+') new_geeks = pickle.load(geekfile) geekterms = new_geeks.keys() geekterms.sort() # start choice = None while choice != "0": print \ """ Geek Translator 0 - Quit 1 - Lo

Re: [Tutor] simple search and replace...

2010-03-31 Thread ALAN GAULD
From: Spencer Parker >Cc: tutor@python.org >Sent: Wednesday, 31 March, 2010 20:30:56 >Subject: Re: [Tutor] simple search and replace... > >That was only a small example of a message...the message contains several >elements. If I have the PID segment then I have OBR segment...an OBX, etc. >So

Re: [Tutor] simple search and replace...

2010-03-31 Thread Spencer Parker
That was only a small example of a message...the message contains several elements. If I have the PID segment then I have OBR segment...an OBX, etc. So it would have to cycle through finding each element that is in the message till the end. I actually meant a list and not a dictionary...terminol

Re: [Tutor] simple search and replace...

2010-03-31 Thread Alan Gauld
"Spencer Parker" wrote MSH|~^\&|SCW|SMED|COR||20100305123742||ORU^R01|100305123742891|P|2.2|||PID|||001109660||TEST^Man||19920519|M||00055254593|699-63-1152||| What I want to do is where it says, PID, is add a line break right before that to knock it down to a new line. I

Re: [Tutor] help

2010-03-31 Thread Oshan Modi
i understood.. its working fine now. thank u all.. ^_^ On Wed, Mar 31, 2010 at 8:20 PM, bob gailer wrote: > Thank you for specifics. > > Please always reply-all so a copy goes to the list. > > > On 3/30/2010 3:41 PM, Oshan Modi wrote: > >> >> I have windows 7 (ultimate), python 2.6.3... >> when

[Tutor] simple search and replace...

2010-03-31 Thread Spencer Parker
I am writing a script to help me add line breaks at certain segments of HL7 messages. Not sure if anyone here is familiar with what an HL7 message is or not. We receive them out of our database with all the segments on one line. I am trying to write a script to allow me to separate them at a cer

Re: [Tutor] help

2010-03-31 Thread bob gailer
Thank you for specifics. Please always reply-all so a copy goes to the list. On 3/30/2010 3:41 PM, Oshan Modi wrote: I have windows 7 (ultimate), python 2.6.3... when i try to run the file echoinput.py Please post a copy of this file. it doesnt respond to the request Actually you should

Re: [Tutor] Remote access from Windows PC to a Linux box

2010-03-31 Thread Tim Golden
On 30/03/2010 17:29, Mike Baker wrote: I'm trying to connect to a Linux box from my Windows machine and execute a series of commands I want a script to always execute the same series of commands without having to do so manually. I also have code that will execute a single command like cat a fi

Re: [Tutor] characters

2010-03-31 Thread Alan Gauld
"Shurui Liu (Aaron Liu)" wrote In Python, could space be counted as a character same as a letter? In Python the fastest and most certain way to answer such questions is to try it at the >>> prompt. len('ab cd') # is it 4 or 5? 5 HTH, -- Alan Gauld Author of the Learn to Program web