Re: [Tutor] communication between java and python?

2005-01-13 Thread Danny Yoo
On Thu, 13 Jan 2005, joeri honnef wrote: > I'm trying to communicate between Python and Java and using os.popen(). > But thing dont work...The Java program reads strings from stdin and the > python program just writes to stdout. Hi Joeri, You may want to look at: http://www.python.org/do

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Liam Clarke
I'm using 2.3, I was trying to be as explicit as possible. *grin* On Thu, 13 Jan 2005 22:02:13 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > I assume that both you and Liam are using previous-er versions of python? > Now files are iterators by line and you can do this. > > openFile = open("probe_

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Jacob S.
I assume that both you and Liam are using previous-er versions of python? Now files are iterators by line and you can do this. openFile = open("probe_pairs.txt","r") indexesToRemove = [] for line in openFile: if line.startswith("Name="): line = '' ## Ooops, this won't work because it

Re: [Tutor] Re: Is Tkinter the Gui in python

2005-01-13 Thread Liam Clarke
On Fri, 14 Jan 2005 09:51:48 +0900, Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote: > > > So tkinter is a good module to use if you only want simple widgets, > > > but be prepared to switch to something newer when you hit it's > > limitations. > > This I agree with totally, fortunately I

Re: [Tutor] Re: communication between java and python?

2005-01-13 Thread Jeff Shannon
Lee Harr wrote: I'm trying to communicate between Python and Java and using os.popen(). But thing dont work...The Java program reads strings from stdin and the python program just writes to stdout. [...] """ popen(command[, mode[, bufsize]]) Open a pipe to or from command. The return value is an op

Re: [Tutor] Tix and Table printing

2005-01-13 Thread Guillermo Fernandez Castellanos
Hi, Exactly what I was looking for! I'm not yet used to search in the cookbook... and I though such "basic" widget would have been implemented directly in Tk or Tix... Thanks a lot to both of you! G On Thu, 13 Jan 2005 12:06:51 -0800 (PST), Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Thu,

[Tutor] please help me improve my python style

2005-01-13 Thread Vincent Wan
I have my first python program working (thank you for the help all). Will anyone give me hints on how my program could be improved and on how I could improve my programing style? I want it to be well written as it can be but also as close to self documenting and understandable to the average

Re: [Tutor] Re: Is Tkinter the Gui in python

2005-01-13 Thread Guillermo Fernandez Castellanos
> > So tkinter is a good module to use if you only want simple widgets, > > but be prepared to switch to something newer when you hit it's > limitations. > This I agree with totally, fortunately I've yet to hit itslimitations > in my fairly simple GUIs. Well... there's also Tix... but I don't know

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Alan Gauld
> I have looked into many books including my favs( > Larning python and Alan Gaulds Learn to program using Yes this is pushing regex a bit further than I show in my book. > What I want to extract: > I want to extract 164:623: > Which always comes after _at: and ends with ; You should be able to

[Tutor] Re: communication between java and python?

2005-01-13 Thread Lee Harr
I'm trying to communicate between Python and Java and using os.popen(). But thing dont work...The Java program reads strings from stdin and the python program just writes to stdout. -first call the java program using: handlers = os.popen('java StdIn) -then:

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Alan Gauld
> My list looks like this: List name = probe_pairs > Name=AFFX-BioB-5_at > Cell1=96 369 N control AFFX-BioB-5_at > Cell2=96 370 N control AFFX-BioB-5_at > Cell3=441 3 N control AFFX-BioB-5_at > Cell4=441 4 N control AFFX-BioB-5_at > ... > My Script: > >>> name1 = '[N][a][m][e][=]' Why not just: 'N

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Karl Pflästerer
On 13 Jan 2005, [EMAIL PROTECTED] wrote: > My list looks like this: List name = probe_pairs > Name=AFFX-BioB-5_at > Cell1=96 369 N control AFFX-BioB-5_at > Cell2=96 370 N control AFFX-BioB-5_at > Cell3=441 3 N control AFFX-BioB-5_at > Cell4=441 4

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread jfouhy
Quoting kumar s <[EMAIL PROTECTED]>: > For example: > > I have a simple list like the following: > > >>> seq > ['>probe:HG-U133B:20_s_at:164:623; > Interrogation_Position=6649 ; Antisense;', > 'TCATGGCTGACAACCCATCTTGGGA'] > > > Now I intend to extract particular pattern and write > to anot

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread kumar s
Hello group: thank you for the suggestions. It worked for me using if not line.startswith('Name='): expression. I have been practising regular expression problems. I tumle over one simple thing always. After obtaining either a search object or a match object, I am unable to apply certain metho

[Tutor] Jythonc compile error

2005-01-13 Thread Ismael Garrido
Hello. I don't know what's wrong. Any help is welcome. Thanks Ismael testui.py ### import Java #Tried with and without this line print "Hello World!" ### H:\ARCHIV~1\Jython>jythonc -c -d -j test testui.py processing testui Required packages: Creating adapters: Creating .java files: testui

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread "Jörg Wölke"
> Quoting Jeff Shannon <[EMAIL PROTECTED]>: [ snip ] > (hmm, I wonder which is the faster option...) Propably "grep -v ^Name= filename" > -- > John. 0.2 EUR, J"o! -- Wir sind jetzt ein Imperium und wir schaffen uns unsere eigene Realität. Wir sind die Akteure der Geschichte, und Ihnen, I

[Tutor] Referer file from import

2005-01-13 Thread Chad Crabtree
Is there a way to know what the path of the file is that imported a module? I've tried __file__ and playing with globals() but I can't seem to crack this. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://ma

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread jfouhy
Quoting Jeff Shannon <[EMAIL PROTECTED]>: > If the intent is simply to remove all lines that begin with "Name=", > and setting those lines to an empty string is just shorthand for that, > it'd make more sense to do this with a filtering list comprehension: [...] > If one wants to avoid list comp

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Jeff Shannon
Liam Clarke wrote: openFile=file("probe_pairs.txt","r") probe_pairs=openFile.readlines() openFile.close() indexesToRemove=[] for lineIndex in range(len(probe_pairs)): if probe_pairs[lineIndex].startswith("Name="): probe_pairs[lineIndex]='' If the intent is simply to remo

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Liam Clarke
...as do I. openFile=file("probe_pairs.txt","r") probe_pairs=openFile.readlines() openFile.close() indexesToRemove=[] for lineIndex in range(len(probe_pairs)): if probe_pairs[lineIndex].startswith("Name="): indexesToRemove.append(lineIndex) for index in indexesToRe

Re: [Tutor] Tix and Table printing

2005-01-13 Thread Danny Yoo
On Thu, 13 Jan 2005, Guillermo Fernandez Castellanos wrote: > Is there any "table" frame that I am unaware of? Hi Guillermo, There are some recipes for making a Tkinter table widget; here's one: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266 There's a Tkinter wiki page t

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Danny Yoo
On Thu, 13 Jan 2005, kumar s wrote: > My list looks like this: List name = probe_pairs > Name=AFFX-BioB-5_at > Cell1=96 369 N control AFFX-BioB-5_at > Cell2=96 370 N control AFFX-BioB-5_at > Cell3=441 3 N control AFFX-BioB-5_at > Cell4=441 4

[Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread kumar s
Dear group: My list looks like this: List name = probe_pairs Name=AFFX-BioB-5_at Cell1=96369 N control AFFX-BioB-5_at Cell2=96370 N control AFFX-BioB-5_at Cell3=441 3 N control AFFX-BioB-5_at Cell4=441 4 N control AFFX-BioB-5_

Re: [Tutor] flattening a list

2005-01-13 Thread Chad Crabtree
You should post this on the Python Cookbook http://aspn.activestate.com/ASPN/Python/Cookbook/ Orri Ganel wrote > Bill Kranec wrote: > > > >> Hello, > > >> > >> I have a list of lists, for example [ [1,2] , [3,4] ], and I would > > >> like to pass all the elements of that list as arguments to a f

Re: [Tutor] Re: Is Tkinter the Gui in python

2005-01-13 Thread Alan Gauld
> cross-platform gui that can be used on as many platforms as possible, > then use tkinter. As far as I know, tkinter isn't really developed nowdays. I assume Tkinter is tracking Tk and Tk is certainly still being developed. A new version was released quite recently I believe. > So tkinter is a g

Re: [Tutor] List comprehensions

2005-01-13 Thread Bob Gailer
At 07:03 AM 1/13/2005, Blake Winton wrote: What about "x === item" Perhaps we should propose an extension to Python: Assignment Statement: name = [[name] = ] ... expression-list. The absence of a name would create an anonymous variable just as lambda creates anonymous functions. Reminds me of a

Re: [Tutor] reinitializing namespace

2005-01-13 Thread Michael Janssen
On Thu, 13 Jan 2005 13:20:11 +0100, Dimitri D'Or <[EMAIL PROTECTED]> wrote: > For some purpose, I would like to reinitialize the main namespace, i.e. I want > to delete all the variables I have created through the use of functions or > keyboard entries. Hello Dimiti, sound like you're talking ab

Re: [Tutor] Tix and Table printing

2005-01-13 Thread John Fouhy
Guillermo Fernandez Castellanos wrote: Is there any "table" frame that I am unaware of? or a way of changing the type of character so I can have a font with characters of equal width? You might see if this does what you want: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266 -- John.

[Tutor] Re: Is Tkinter the Gui in python

2005-01-13 Thread Abel Daniel
"Gopinath V, ASDC Chennai" writes: > Hi > Is the standard Tkinter module in python does the GUI - Front -end > Interface for Python Well, if you mean "standard" as in included by default, then yes. Tkinter however is a sort-of outdated gui. If you only want some basic widgets, like entr

Re: [Tutor] List comprehensions

2005-01-13 Thread Kent Johnson
Blake Winton wrote: Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Does that mean that there are invalid expressions? I'd enjoy seeing an example. I suppose if it's an expressio

Re: [Tutor] List comprehensions

2005-01-13 Thread Blake Winton
Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Does that mean that there are invalid expressions? I'd enjoy seeing an example. I suppose if it's an expression, it must be valid,

Re: [Tutor] flattening a list

2005-01-13 Thread Gonçalo Rodrigues
Chad Crabtree wrote: The only problem with this if it is to big or to deeply nested then it will overflow the stack? Danny Yoo has given a mind-blowing continuation implementation that will not overflow the stack. Below goes a recursive-iterator implementation. To avoid deep recursion the code

[Tutor] reinitializing namespace

2005-01-13 Thread Dimitri D'Or
Hello list, For some purpose, I would like to reinitialize the main namespace, i.e. I want to delete all the variables I have created through the use of functions or keyboard entries. At the same time, I want to keep all the modules I have imported so that I can use their functions again withou

Re: [Tutor] List comprehensions

2005-01-13 Thread Max Noel
On Jan 13, 2005, at 04:13, Bob Gailer wrote: I like Kent's response. foobar(item)/0 is a "valid" expression. It fits the grammar of expressions. The fact that it raises an exception does not make it an invalid expression. Consider foobar(item)/xyz. It is valid. If xyz == 0 then it will also rai

[Tutor] Tix and Table printing

2005-01-13 Thread Guillermo Fernandez Castellanos
Hi, I have a table of information that look like this (only 3 lines here): Gibraltar Division BR INF D 095 59 GAR None 10-7-4-6 Gibraltar Kuwait Division BR INF D 148 71GAR None 2-1-0-4 Kuwait Somaliland Division BR INF D 139 84 GAR None 2-1-0-3 None I would like to show this in a nice

Re: [Tutor] sorry, another update bug

2005-01-13 Thread Kent Johnson
The problem is your mutate_genome() function which mutates the genome in place. So all the living_species are using the same genome (they all reference the same list). The solution is to have mutate_genome() copy the genome. You can do this by adding the line a_genome = a_genome[:] to the sta

Re: [Tutor] sockets, files, threads

2005-01-13 Thread Alan Gauld
> Where did my 'ooo' go? > > #! /usr/bin/env python > import os > > fobj = open('/tmp/xxx','w') > fobj.write('ooo\n') fobj.flush() File objects use buffered IO and by changing from using file objects to file descriptors half way through the buffer could be in any state. You need to flush() to