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 =
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
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\
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
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
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
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 ?
>
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
> 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
> "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)
>>>
>> 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
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
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
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
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.
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,
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
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
[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']
>
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
> 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
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', '
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.
23 matches
Mail list logo