Re: [Tutor] Apple Remote "Mouse"

2006-03-31 Thread Tim Golden
[Johnston Jiaa] | I recently bought a Macbook Pro from Apple. As it comes with | a remote, I thought it would be great to use it as a mouse | when not in Front Row. The fast forward button would move | the cursor to the left, the volume increase would move it up | the screen, etc and the pla

Re: [Tutor] XML node name and property

2006-03-31 Thread Kent Johnson
Keo Sophon wrote: > Hi all, > > How can I get a name of an XML node and and its property name and its > property > value? How are your reading the XML? (xml.dom, ElementTree, BeautifulSoup...) Kent ___ Tutor maillist - [email protected] http://mail

[Tutor] getAttribute

2006-03-31 Thread kakada
Hello all, Could anyone help me by giving example of getAttribute xmldata = ziparchive.read("content.xml") xmldoc = minidom.parseString(xmldata) officeNode = xmldoc.getElementsByTagName('office:text') I have another function: def go_thru (nodelist): for x in range(nodelist.length): n

Re: [Tutor] XML node name and property

2006-03-31 Thread Keo Sophon
On Friday 31 March 2006 17:37, Kent Johnson wrote: > Keo Sophon wrote: > > Hi all, > > > > How can I get a name of an XML node and and its property name and its > > property value? > > How are your reading the XML? (xml.dom, ElementTree, BeautifulSoup...) > > Kent > > __

[Tutor] how to get the content of an XML elements.

2006-03-31 Thread Keo Sophon
Hi all, Is there anyway to get the content of an XML elements. I am using xml.dom. Thanks, Phon ___ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Multi-thread environments

2006-03-31 Thread Liam Clarke
Thanks very much for that Kent, works fine and dandy now. >_< This is one to chalk up to experience. I copied the dicts as you said. Regards, Liam On 3/31/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > Liam Clarke wrote: > > Hi all, > > > > I'm working in my first multi-threaded environments, an

Re: [Tutor] XML node name and property

2006-03-31 Thread Kent Johnson
Keo Sophon wrote: > On Friday 31 March 2006 17:37, Kent Johnson wrote: > >>Keo Sophon wrote: >> >>>How can I get a name of an XML node and and its property name and its >>>property value? >> >>How are your reading the XML? (xml.dom, ElementTree, BeautifulSoup...) >> > > I am using xml.dom. I gen

Re: [Tutor] getAttribute

2006-03-31 Thread Kent Johnson
kakada wrote: > Hello all, > > Could anyone help me by giving example of getAttribute > > xmldata = ziparchive.read("content.xml") > xmldoc = minidom.parseString(xmldata) > officeNode = xmldoc.getElementsByTagName('office:text') > > I have another function: > def go_thru (nodelist): > for x

[Tutor] Looking for Constructs to Remove Redundant Code

2006-03-31 Thread Ilias Lazaridis
I have this python code class Car: """Type of car.""" manufacturer = f.string() model = f.string() modelYear = f.integer() _key(manufacturer, model, modelYear) def __str__(self): return '%s %s %s' % (self.modelYear, self.manufacturer, self.model) - and w

Re: [Tutor] Looking for Constructs to Remove Redundant Code

2006-03-31 Thread Kent Johnson
Ilias Lazaridis wrote: > I have this python code > > class Car: > """Type of car.""" > > manufacturer = f.string() > model = f.string() > modelYear = f.integer() > > _key(manufacturer, model, modelYear) > > def __str__(self): > return '%s %s %s' % (self.mo

[Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread jonasmg
From a table, I want to get the cells for then only choose some of them. WY Wyo. ... Using: for row in table('tr'): print row.contents ['\n', WY, '\n', Wyo., '\n'] [...] I get a new line character between each cell. Is possible get them without those '\n'? Thanks in advance

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > From a table, I want to get the cells for then only choose some of them. > > > > WY > Wyo. > > ... > > > Using: > > for row in table('tr'): print row.contents > >['\n', WY, '\n', Wyo., '\n'] >[...] > > I get a new line character between each cell.

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread jonasmg
Kent Johnson writes: > [EMAIL PROTECTED] wrote: >> From a table, I want to get the cells for then only choose some of them. >> >> >> >> WY >> Wyo. >> >> ... >> >> >> Using: >> >> for row in table('tr'): print row.contents >> >>['\n', WY, '\n', Wyo., '\n'] >>[...] >> >>

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Kent Johnson writes: > > >>[EMAIL PROTECTED] wrote: >> >>> From a table, I want to get the cells for then only choose some of them. >>> >>> >>> >>>WY >>>Wyo. >>> >>>... >>> >>> >>>Using: >>> >>>for row in table('tr'): print row.contents >>> >>> ['\n', WY, '\n

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread jonasmg
Kent Johnson writes: > [EMAIL PROTECTED] wrote: >> Kent Johnson writes: >> >> >>>[EMAIL PROTECTED] wrote: >>> From a table, I want to get the cells for then only choose some of them. WY Wyo. ... Using: for row in table('tr'

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > You have reason but the problem is that some cells have anchors. > Sorry, I forgot myself to say it. > > and using: > > for row in table('tr'): > cellText = [cell.string for cell in row('td')] > print cellText > > I get null values in cell with anchors. Ca

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread jonasmg
Kent Johnson writes: > [EMAIL PROTECTED] wrote: >> You have reason but the problem is that some cells have anchors. >> Sorry, I forgot myself to say it. >> >> and using: >> >> for row in table('tr'): >> cellText = [cell.string for cell in row('td')] >> print cellText >> >> I get

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > List of states: > http://en.wikipedia.org/wiki/U.S._state > > : soup = BeautifulSoup(html) > : # Get the second table (list of states). > : table = soup.first('table').findNext('table') > : print table > > ... > > WY > Wyo. > Wyoming > Cheyenne > Cheyenne > src="ht

[Tutor] Inverted Index Algorithm

2006-03-31 Thread Steve Nelson
Hello All, I've been reading about "Inverted Indexing" - I'd like to try to write something in Python that illustrates the concpet, as I've got to give a presentation about it. Where would be a good place to start? S. ___ Tutor maillist - Tutor@pytho

[Tutor] Python app and UNIX commands

2006-03-31 Thread William Mhlanga
Hello, I have come up with an idea of an app that I would like to write using python but I need some guidance. I would like to write an app for Linux/Unix that fetches a gzipped or bzipped file from a remote server by http or ftp.  The file will be downloaded to a temporary directory, unzipped and

Re: [Tutor] Python app and UNIX commands

2006-03-31 Thread w chun
> I would like to write an app for Linux/Unix > that fetches a gzipped or bzipped file from a remote server by http or ftp. > The file will be downloaded to a temporary directory, unzipped and its > contents copied to specific directory. If the process has gone well, the > files in the temporary di

Re: [Tutor] Apple Remote "Mouse"

2006-03-31 Thread w chun
> ... this seems to me to be the kind of query where > you could legitimately post to the main Python > newsgroup / mailing list and/or to some Mac-specific > one, if there is such a thing. ... and there is: http://mail.python.org/mailman/listinfo/pythonmac-sig cheers, -- wesley - - - - - - - -

Re: [Tutor] BeautifulSoup - getting cells without new line characters

2006-03-31 Thread jonasmg
Kent Johnson writes: > [EMAIL PROTECTED] wrote: > >> List of states: >> http://en.wikipedia.org/wiki/U.S._state >> >> : soup = BeautifulSoup(html) >> : # Get the second table (list of states). >> : table = soup.first('table').findNext('table') >> : print table >> >> ... >> >> WY >> Wyo.

Re: [Tutor] Inverted Index Algorithm

2006-03-31 Thread Kent Johnson
Steve Nelson wrote: > Hello All, > > I've been reading about "Inverted Indexing" - I'd like to try to write > something in Python that illustrates the concpet, as I've got to give > a presentation about it. > > Where would be a good place to start? Do you need help getting started with Python or

Re: [Tutor] removing file from zip archive.

2006-03-31 Thread w chun
> How can we remove one file inside of a zip archive? > > import zipfile > ziparchive = zipfile.ZipFile('test.odt', 'r') > xmldata = ziparchive.read('content.xml') > ziparchive.close <--- ADD "( )" HERE TOO Sophon, You can remove any number of files from a ZIP fil

[Tutor] request for sugestions on fragement of code for generating truth-tables

2006-03-31 Thread Brian van den Broek
Hi all, I've been too busy with life to do much Python of late. So, I am a bit rusty. :-( I've got some code that does what it needs to but I think I might be overlooking a much smoother way to get what I need. The code takes a list of strings and returns a list of dictionaries, where each dic

[Tutor] Python + PostGreSQL

2006-03-31 Thread Srinivas Iyyer
Dear group, I want to connect python to postgresql. My python dist. is 2.4.2 My postgres: 8.1.2 My system: Linux Enterprise Linux, Intel Xeon, 4GB RAM. I tried to install pygresql: version: 3.8, it failed throwing exception : Exception: pg_config tool is not available. I gave another try on go

Re: [Tutor] Looking for Constructs to Remove Redundant Code

2006-03-31 Thread Ilias Lazaridis
Kent Johnson wrote: ... Thank you for your comments. I realize that my request was not very clear. I make a 2nd attemp, more simplified: I have this python code: class Car(BaseClass) : manufacturer = stringFactory() model = stringFactory() modelYear = integerFactory() d

Re: [Tutor] Python + PostGreSQL

2006-03-31 Thread Bill Campbell
On Fri, Mar 31, 2006, Srinivas Iyyer wrote: >Dear group, > >I want to connect python to postgresql. >My python dist. is 2.4.2 >My postgres: 8.1.2 >My system: Linux Enterprise Linux, Intel Xeon, 4GB >RAM. > >I tried to install pygresql: version: 3.8, it failed >throwing exception : Exception: pg_c

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-03-31 Thread Danny Yoo
> Then, the output is like so: > > >>> atoms = ["a","b","c"] > >>> tvas = tva_dict_maker(atoms) > >>> display_tvas(tvas) > a:Trueb:True c:True > a:Trueb:True c:False > a:Trueb:False c:True > a:Trueb:False c:False > a:False b:True c:True > a:False

Re: [Tutor] Python + PostGreSQL

2006-03-31 Thread w chun
> >I tried to install pygresql: version: 3.8, it failed > >throwing exception : Exception: pg_config tool is not > >available. > > > >I gave another try on google and Postgres site and > >found Pypgsql, PoPy and psycopg1. > > I think that psycopg is generally considered the preferred > package. a

Re: [Tutor] Python + PostGreSQL

2006-03-31 Thread Srinivas Iyyer
Thanks Bill, and wesley, Psycopg worked for me. I had to use setup.cfg . Regular setup.py did not work. AFA, pygresql I did used this some 2 years back. However, the install was pretty easy due to proper redhat rpm updates. I felt more comfortable with PyGreSQL. I liked it somehow. tar -xvf

Re: [Tutor] Python + PostGreSQL

2006-03-31 Thread w chun
hi srini, i don't know what your system configuration was like for the installation, but from what i saw in your post (below), it just seems like /usr/local/pgsql/bin was not in your path since it looks like "sh" could not find the pg_config command, not Python (which choked afterwards). anyway,

Re: [Tutor] Inverted Index Algorithm

2006-03-31 Thread Steve Nelson
On 3/31/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > Steve Nelson wrote: > > Do you need help getting started with Python or with inverted indexing > in particular? Sorry - I should have been clearer. I'm reasonably confident in Python, and if I get stuck with that side of things will ask for he

[Tutor] Capture keyboard input even without python in focus

2006-03-31 Thread Ars
What commands could capture input from the keyboard (and the mouse while we're at it) even when the running python program isn't the program in focus? Sorta like a keylogger, though that's not my goal (wouldn't be very secret with a python console running anyways lol.)   -Jack ___

Re: [Tutor] Inverted Index Algorithm

2006-03-31 Thread Danny Yoo
> The next step would be to introduce an index. I think again, the > simplest thing that could possibly work would be a literal index of > every word and every document in which it appears. This would save > processing time, but wouldn't be very intelligent. Yes, that's right, that's the idea