[Tutor] Is this called a 'Hash table method for string mapping'

2006-09-03 Thread Srinivas Iyyer
Dear group, for mapping a string of protein/nucleotides, BLAST is one tool that is highly sought. However, its performance is limited due to some factors and one such factor is length of the query string. IF the length of the query string is less than 30 characters, its output is questionable.

Re: [Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Dick Moores
At 03:07 PM 9/3/2006, Luke Paireepinart wrote: [snip] Ah, I'd forgotten that in shuffle( x[, random], "random" would be the default. But please bear with me. Using your function a, I wrote testShuffle.py: # testShuffle.py from random import * def a():     return 0.5 lst = ['1', '2', '3', '

Re: [Tutor] tempfile and webbrowser

2006-09-03 Thread Alan Gauld
> This program works: > ** > import webbrowser > a = open('test.htm','wb') Any particular feason to open the file in binary mode? That can sometimes cause odd things to happen. > a.write("Test") > webbrowser.open(a.name) > a.close() The close should come before the browser reads the fi

Re: [Tutor] pretty_printing

2006-09-03 Thread Dave Kuhlman
On Mon, Sep 04, 2006 at 09:41:26AM +1200, John Fouhy wrote: > On 04/09/06, Lowell H. Tackett <[EMAIL PROTECTED]> wrote: > > I would like to---so far without luck--to print out my Python scripts with > > syntax highlighting (using Mandrake Linux as my OS/host.) Using enscript > > has > > not gotte

Re: [Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Luke Paireepinart
[snip] Ah, I'd forgotten that in shuffle( x[, random], "random" would be the default. But please bear with me. Using your function a, I wrote testShuffle.py: # testShuffle.py from random import * def a():     return 0.5 lst = ['1', '2', '3', '4'] shuffle(lst,a) print lst >>> ['1', '4', '2', '3'] >

Re: [Tutor] pretty_printing

2006-09-03 Thread John Fouhy
On 04/09/06, Lowell H. Tackett <[EMAIL PROTECTED]> wrote: > I would like to---so far without luck--to print out my Python scripts with > syntax highlighting (using Mandrake Linux as my OS/host.) Using enscript has > not gotten me anywhere; nor has a package I found on the *net called > 'pretty-pri

Re: [Tutor] tempfile and webbrowser

2006-09-03 Thread yves
Kent Johnson a écrit : > The problem is that the file is never actually written because you omit > the close. But when you do close the temp file, it is deleted. Try using > a.flush() instead of a.close(), that will force the file to be written. > Alternately use tempfile.mkstemp() which lets y

Re: [Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Dick Moores
At 04:43 AM 9/3/2006, Kent Johnson wrote: >Dick Moores wrote: > > http://docs.python.org/lib/module-random.html says, > > > > "shuffle( x[, random]) > > Shuffle the sequence x in place. The optional argument random is > a 0-argument > > function returning a random float in [0.0, 1.0); by default,

Re: [Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Dick Moores
At 01:51 AM 9/3/2006, Luke Paireepinart wrote: On 9/3/06, Dick Moores <[EMAIL PROTECTED]> wrote: http://docs.python.org/lib/module-random.html says, "shuffle( x[, random]) Shuffle the sequence x in place. The optional argument random is a 0-argument function returning a random float in [0.

[Tutor] pretty_printing

2006-09-03 Thread Lowell H. Tackett
Hello, folks. These seems as good as another question to take a first plunge into your forum. I would like to---so far without luck--to print out my Python scripts with syntax highlighting (using Mandrake Linux as my OS/host.) Using enscript has not gotten me anywhere; nor has a package I fou

Re: [Tutor] tempfile and webbrowser

2006-09-03 Thread Kent Johnson
yves wrote: > Hello tutors, > > This programm works: > ** > import webbrowser > a = open('test.htm','wb') > a.write("Test") > webbrowser.open(a.name) > a.close() > *** > but I would like to avoid the risk of overwriting an already existing > "test.htm" file, so I try to use the modu

[Tutor] tempfile and webbrowser

2006-09-03 Thread yves
Hello tutors, This programm works: ** import webbrowser a = open('test.htm','wb') a.write("Test") webbrowser.open(a.name) a.close() *** but I would like to avoid the risk of overwriting an already existing "test.htm" file, so I try to use the module tempfile: *** import tem

Re: [Tutor] about random seed

2006-09-03 Thread Danny Yoo
>> random.seed() sets the starting number for the generator. Setting the >> seed to a known value can be important if you want the same sequence of >> pseudorandom numbers to be generated each time you test/run your >> program. >> > I still can not understand. can you show me an example? Hi Lin

Re: [Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Alan Gauld
> "shuffle( x[, random]) > Shuffle the sequence x in place. The optional argument random is a > 0-argument function returning a random float in [0.0, 1.0); by > default, this is the function random()." > from random import shuffle, random lst = ["a", "b", "c", "d"] shuffle(lst) >>>

Re: [Tutor] Problem with Pythonwin

2006-09-03 Thread Alan Gauld
> I am using a windows box and I have installed Activestate > ActivePython 2.4 > When I start Pythonwin IDE, it gives me the following error: > > * File "", line 1, in ? > File > "C:\python\Lib\site-packages\pythonwin\pywin\framework\startup.py", > line 49, in ? >exec "import %s\n" % module

Re: [Tutor] Handling hundreds of thousands of inserts with MySQLdb

2006-09-03 Thread Kent Johnson
Gonzillaaa wrote: > another issue is that some of the fields values are empty and I > get the following : > > ./xbow_MySQL_insert.py:49: Warning: Out of range value adjusted for > column 'sample' at row 64 >cursor.executemany("INSERT INTO arup_04 \ > > is there a way to "silence" python so

Re: [Tutor] Problem with Pythonwin

2006-09-03 Thread Kent Johnson
Asrarahmed Kadri wrote: > Hi folks, > > > I am new to Python and have just taken a few steps in this long journey.. > > I am using a windows box and I have installed Activestate ActivePython 2.4 > > When I start Pythonwin IDE, it gives me the following error: > > File "re.py", line 9, in ? >

Re: [Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Kent Johnson
Dick Moores wrote: > http://docs.python.org/lib/module-random.html says, > > "shuffle( x[, random]) > Shuffle the sequence x in place. The optional argument random is a 0-argument > function returning a random float in [0.0, 1.0); by default, this is the > function random()." > > >>> from random

Re: [Tutor] Problem with Pythonwin

2006-09-03 Thread Henry Dominik
It is very hard to know what caused that, but could you post the piece of code you were trying to execute??   Or did you get the error when you opened the Pythonwin without any code??   -- Dominik     - Original Message - From: Asrarahmed Kadri To: tutor@python.org Sent: S

Re: [Tutor] Handling hundreds of thousands of inserts with MySQLdb

2006-09-03 Thread Karl Pflästerer
On 2 Sep 2006, [EMAIL PROTECTED] wrote: > > Hello all. I post this here since is my first attempt to solve a > problem with python. > > I have fairly big log files that I'm doing some pre-processing to, to > cleanup the data before they go into a MySQL database. After > processing the files

[Tutor] Problem with Pythonwin

2006-09-03 Thread Asrarahmed Kadri
Hi folks,     I am new to Python and have just taken a few steps in this long journey..   I am using a windows box and I have installed Activestate ActivePython 2.4   When I start Pythonwin IDE, it gives me the following error:     File "", line 1, in ?  File "C:\python\Lib\site-packages\pythonwin\

Re: [Tutor] about random seed

2006-09-03 Thread Roel Schroeven
linda.s schreef: > I still can not understand. can you show me an example? > Thanks! > Linda Example program: import random random.seed(42) for i in range(10): print random.random() At the start of the program, the random number generator is seeded with 42. This could be any number, but t

[Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Dick Moores
http://docs.python.org/lib/module-random.html says, "shuffle( x[, random]) Shuffle the sequence x in place. The optional argument random is a 0-argument function returning a random float in [0.0, 1.0); by default, this is the function random()." >>> from random import shuffle, random >>> lst =