Richard D. Moores wrote:
On Sat, Jul 17, 2010 at 18:01, Steven D'Aprano wrote:
import random
def random_digits(n):
"Return n random digits with one call to random."
return "%0*d" % (n, random.randrange(10**n))
Thanks for implementing what I was suggesting, using zero-fill for
Steven D'Aprano wrote:
On Sun, 18 Jul 2010 08:30:05 pm Richard D. Moores wrote:
What do you mean, "couldn't handle"? Couldn't handle 800 million of
what? Obviously not bytes, because your laptop *can* handle well over
800 million bytes. It has 4GB of memory, after all :)
This is just
ZUXOXUS wrote:
Oh, I think i got it:
for prod in itertools.product('ABC', 'ABC'):
print(prod)
('A', 'A')
('A', 'B')
('A', 'C')
('B', 'A')
('B', 'B')
('B', 'C')
('C', 'A')
('C', 'B')
('C', 'C')
Thank you very much!!
2010/7/28 ZUXOXUS
You're top-posting, which loses all the
ZUXOXUS wrote:
2010/7/28 Dave Angel
Your latest version gets the product of two. But if you want an arbitrary
number, instead of repeating the iterable ('ABC' in your case), you can use
a repeat count. That's presumably what you were trying to do in your
earlier incantation.
ZUXOXUS wrote:
My doubt now is whether I can change the way python show the combinations.
I mean, here's what python actually does:
for prod in itertools.product('abc', repeat=3):
print(prod)
('a', 'a', 'a')
('a', 'a', 'b')
('a', 'a', 'c')
('a', 'b', 'a')
('a', 'b', 'b')
('a', '
David Hutto wrote:
I'll probably ending up reading something about it later in the book,
but as a quick question, why does:
5e18 =5**18
False
int(5e18) =int(5**18)
False
1.01325e5 =1.01325**5
False
The 999e44 notation is intended to be similar t
Michael Bernhard Arp S wrote:
Greetings, programs.
How do I create a sound from python? I'm thinking along the line of
generating a sinus wave where I can control the frequency and duration. I
want to produce a string of sounds based on a character string. Probabl
Eric Hamiter wrote:
On Sat, Jul 31, 2010 at 4:48 PM, bob gailer wrote:
Please post that code, and the URL you use to invoke it.
test.py: this works on my laptop but not on the server
http://pastebin.com/ChjUzLRU
test-working.py: this works on both laptop & server
http://pastebin
Alex Hall wrote:
On 8/4/10, Evert Rol wrote:
That depends how you create the Pile of 52 cards: list(52) also doesn't
generate 52 (random) items.
If you override __init__ to accept an integer that generates the cards for
you, this should work.
Here is my init, not half as pretty as you
nitin chandra wrote:
Hello Everyone,
I am to make a small programme for a friend of mine
where i am to start reading from 14th (string) from a file and then
read every 5th row.
ie.
in 1st read it reads the 14 row in a File, write to an OUTPUT-1 file
Next reads 19th row, write to the OUTPUT-1 f
Shurui Liu wrote:
Okay. I am using WinXP, Python 3.1 on my workstation.
And this is the Python version information I got from putty.exe:
Python 2.5.4 (r254:67916, Apr 13 2009, 18:09:11)
[GCC 4.2.1 20070719 [FreeBSD]] on freebsd7
You cannot use the same python source on 2.5 as you do in 3.1
Richard D. Moores wrote:
On Sun, Aug 8, 2010 at 08:11, bob gailer wrote:
On 8/8/2010 1:57 AM, Richard D. Moores wrote:
How were we supposed to know that all the hexes have 2 digits?
In version 2.6.5 Language Reference 2.4.1 - String literals:
\xhh Character with hex value
nitin chandra wrote:
This may help you get started.
FileNames ="FileName01", "FileName02", ..., "FileName24"]
for File in FileNames:
List =pen(File, 'r').readlines()
for Start in [[14, "%s-1" % File], [15,"%s-2" % File]]:
OutList =]
for Line in range(Start[0]-1, 3024, 5):
Steven D'Aprano wrote:
On Mon, 9 Aug 2010 07:23:56 pm Dave Angel wrote:
Big difference between 2.x and 3.x. In 3.x, strings are Unicode, and
may be stored either in 16bit or 32bit form (Windows usually compiled
using the former, and Linux the latter).
That's an internal st
Steven D'Aprano wrote:
On Mon, 9 Aug 2010 11:51:34 pm you wrote:
(Context: Python 3.x, where strings are unicode.)
repr() returns the string
representation, not the byte representation. Try this:
That's what I was missing. Somehow I assumed it was converting to byte
strings.
I
Steven D'Aprano wrote:
On Tue, 10 Aug 2010 02:24:00 pm Dave Angel wrote:
Any suggestions how to fix the Windows console to interpret utf8?
I don't know about Windows, but under Linux there is a menu command for
most xterms that let you set it.
Googling led me to this pa
Knacktus wrote:
Hi everyone,
I'm wondering what's the fastet datatype in python to lookup the last
element in an ordered collection. I know about lists, of course, and
read about deques. As I understand deques have better performance for
popping and adding elements, but I didn't understand wh
Evidenca B d.o.o. wrote:
Hi.
I have a problem. I am making pa program which, makes a .txt document, the
problem is in my language have special character like this: č,š,ž. They don
t appear in aschi code, but you can find them in UTF-8 code. So wen I wont
to save with writelines a string with
Chorn, Guillaume wrote:
Hi All,
I know that I can look up the value for a particular key in a
dictionary, but can I look up the key associated with a particular
value? I understand that this could be problematic from the standpoint
of multiple keys having the same value, but even then I feel li
Laurens Vets wrote:
Yes of course :) That's a typo on my part. I came up with the
following which I think works as well?
import random
reeks = []
for i in range(60):
temp = [random.randint(1, 6)]
while reeks[-2:-1] == reeks[-1:] == temp:
temp = [random.randint(1, 6)]
if reeks.
(You top-posted, so now I have to delete the older part)
Vince Spicer wrote:
Hey you can use list comprehension here
age_dict = { 'pete': 42, 'ann': 25, 'carl': 30, 'amanda': 64 }
you can create a dict from a list of tuples and you can access the dict as
a
list of tuples by accessing its items
Roelof Wobben wrote:
def is_odd(argument):
uitkomst=is_even(argument)
return uitkomst
You forgot to indent the return statement to match the other
statement(s) in the function.
DaveA
___
Tutor maillist - Tutor@python.org
To un
You need to figure out how to get your email program to do quoting. As
it stands, there's no good way to tell what part of the following
message was from you, and what part was from wayne, or maybe others.
Probably all you need to do is to do a reply-all to the message, and
it'll mark the ex
(Don't top-post, it loses all the context)
Roelof Wobben wrote:
Hello,
Now I have this :
def add_vectors(u, v):
"""
>>> add_vectors([1, 0], [1, 1])
[2, 1]
>>> add_vectors([1, 2], [1, 4])
[2, 6]
>>> add_vectors([1, 2, 1], [1, 4, 3])
[2, 6, 4]
Roelof Wobben wrote:
Date: Fri, 27 Aug 2010 14:27:34 -0400
From: da...@ieee.org
To: rwob...@hotmail.com
CC: alan.ga...@btinternet.com; tutor@python.org
Subject: Re: [Tutor] exercise problem
The other problem is you're confusing the variables inside the function
with the ones declared outside
Steven D'Aprano wrote:
On Mon, 30 Aug 2010 05:31:00 am bob gailer wrote:
My current reasoning was something of this sort: Find all the
factors of a number, then reduce them to just the prime factors
Very inefficient. IMHO the proper way is to generate a list of all
the prime numbers
lists wrote:
Hi folks,
I'm new to Python, I'm working my way through some intro books, and I
have a question that I wonder if someone could help me with please?
This is my attempt at solving an exercise where the program is
supposed to flip a coin 100 times and then tell you the number of
heads
Bill Allen wrote:
Say I have and iterable called some_stuff which is thousands of items in
length and I am looping thru it as such:
for x in some_stuff
etc...
However, what if I want only to iterate through only the first ten items of
some_stuff, for testing purposes. Is there a concise
Bill Allen wrote:
Thanks to everyone who replied. Some of the methods presented where some I
had thought of, others were new to me. Particularly, I did not realize I
could apply a slice to a list. The for x in some_stuff[:value] form worked
very well for my purposes. I can also see I need
On 2:59 PM, Dominique wrote:
=
but it's really not fun working with this bloody windows console where cut and
paste is impossible...
Cut and paste work fine in a Windows DOS console. Using Properties,
the Options tab, turn on Quick-Edit mode. Once you've done that, you
can select a recta
On 2:59 PM, Carter Danforth wrote:
Hi, I'm trying to a create a basic addressbook for practice. I'm using a
dictionary with cpickle, though I'm not sure how to persistently store each
instance in the dictionary. Below is the code I have so far.
If I run it once and add a contact and the details
On 2:59 PM, Roelof Wobben wrote:
Now I thought this would work:def readposint():
x = raw_input("Please enter a positive integer :")
try:
x = int(x) and x> 0
except:
print x , "is not a positive integer. Try again."
return False
return Truey = rea
On 2:59 PM, Rance Hall wrote:
Im wanting to use the builtin hashlib functions to encrypt passwords
before storing them in a database.
According to documentation on the python.org site it should be as simple as
import hashlib
hashname = hashlib.sha234 (or whatever other hash method you want
On 2:59 PM, Roelof Wobben wrote:
Hello Bob,
Oke, I try to fish.
When I do
x="a"
y=nt(x)
Then I get ValueError.
When I do
x= 1.2
y=int(x)
No exception is raised.
But when I do then x = I get a false.
When I now do float(x) - int(x) I get 1.2 - 1 =.2 and that's greater then 0
Because one
On 2:59 PM, Rance Hall wrote:
Everybody knows you don't store plain text passwords in a database,
you store hashes instead
consider:
userpass = getpass.getpass("User password? ")
encuserpass = hashlib.md5()
encuserpass.update(userpass)
del userpass
Now the documentation clearly states th
On 2:59 PM, Rance Hall wrote:
Luke:
On python3.1 I get the following error using your (untested) two line snippet:
TypeError: Unicode-objects must be encoded before hashing
If I add the b back into the mix, I get a hash with no error messages.
But I still can't quite figure out how to get th
On 2:59 PM, C.T. Matsumoto wrote:
Hello Tutors,
I was just wondering if you have a dictionary key is it faster to do:
if dict['key'] == 'foo':
...
or is this faster:
if 'foo' in dict['key']:
...
Or is there any difference and I'm chasing ghosts?
Thanks,
T
dict is not a good name
On 2:59 PM, Roelof Wobben wrote:
From: st...@pearwood.info
On Fri, 24 Sep 2010 06:20:25 am Roelof Wobben wrote:
time =ijd()
[...]
print time(uitkomst)
Why are you calling time as a function, when it is a tijd instance?
Hello Steve,
I found t
On 2:59 PM, Bill DeBroglie wrote:
No, I meant that you should edit your .py file and add
#!/usr/bin/env python
as the first line, THEN try to run it.
BINGO!
Right now what's happening is that you're handing a line of Python
script to the shell and asking it to run it; the shell is tellin
On 2:59 PM, Roelof Wobben wrote:
Hello,
Fine that you are in a arque
But can we come back to my problem.
How can I take care that test2 can be initialized.
Roelof
You had this code, and got the following error:
class zoeken() :
pass
def __len__(self):
return 0
def __st
On 2:59 PM, Alex Hall wrote:
On 9/27/10, Brian Jones wrote:
On Mon, Sep 27, 2010 at 11:32 AM, Alex Hall wrote:
Hi all,
One thing I have never much liked about Python is its need for
specifically sized arrays and lack of a dynamic, array-like data
structure. For example, the following fails
On 2:59 PM, Steven D'Aprano wrote:
On Tue, 28 Sep 2010 08:55:36 am Carter Danforth wrote:
class Date:
c = random.randint(16,30)
y = random.randint(0,99)
month = random.randint(1,12)
Here's your problem: you are creating a class where all the attributes
(called "members" in som
On 2:59 PM, Roelof Wobben wrote:
Hello,
Im now studying this page :
http://openbookproject.net/thinkcs/python/english2e/ch16.html
But I don't get it why aces are now lower then deuces in the cmp function.
Roelof
Why would you be surprised that aces are lower than deuces? If aces are
On 2:59 PM, Alex Hall wrote:
On 9/28/10, Steven D'Aprano wrote:
PyPy is a version of Python written in Python. It has an incredible
mission: to eventually produce versions of Python which are faster than
pure C, despite being written in Python itself. Although they have a
long, long way to
On 9/28/2010 10:22 AM, Roelof Wobben wrote:
Date: Tue, 28 Sep 2010 10:02:27 -0400
From: da...@ieee.org
To: rwob...@hotmail.com
CC: tutor@python.org
Subject: Re: [Tutor] question
On 2:59 PM, Roelof Wobben wrote:
Hello,
Im now studying this page :
http://openbookproject.net/thinkcs/pytho
On 9/28/2010 5:11 PM, Carter Danforth wrote:
Thanks for the replies, Dave and Joel. The reason I'm not just using the
time or datetime modules for a random date is because it's restricted to
1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer
about the leap years, Dave, as
On 9/28/2010 5:11 PM, Carter Danforth wrote:
Thanks for the replies, Dave and Joel. The reason I'm not just using the
time or datetime modules for a random date is because it's restricted to
1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer
about the leap years, Dave, as
On 9/29/2010 9:17 PM, Carter Danforth wrote:
On Wed, Sep 29, 2010 at 1:53 PM, Dave Angel wrote:
On 9/28/2010 5:11 PM, Carter Danforth wrote:
Thanks for the replies, Dave and Joel. The reason I'm not just using the
time or datetime modules for a random date is because it's res
On 2:59 PM, Dave Angel wrote:
On 9/29/2010 9:17 PM, Carter Danforth wrote:
On Wed, Sep 29, 2010 at 1:53 PM, Dave Angel wrote:
On 9/28/2010 5:11 PM, Carter Danforth wrote:
Thanks for the replies, Dave and Joel. The reason I'm not just
using the
time or datetime modules for a r
On 2:59 PM, Chris King wrote:
On 9/30/2010 8:43 PM, Steven D'Aprano wrote:
What problem are you trying to solve? There is likely another way to
solve it. (Not necessarily an easy way, but we'll see.)
So I'll have to create my own object which modifies each method to
fire off the set me
On 2:59 PM, Dipo Elegbede wrote:
here is the code:
http://pastebin.com/K2Fxq6ac
kindly help me figure out my mistake.
It is supposed to return a table of environmental variables but it returns
only the header and a blank page.
thanks
Care to define "return" ?
How are you running this cod
On 2:59 PM, Alan Gauld wrote:
"Francesco Loffredo" wrote
did, Roelof's code would work perfectly, and you could store in a list
all the subsequent changes of a dictionary without calling them with
different names.
You don;'t need dfifferent names. Provided the name creates a
new object ins
On 2:59 PM, aenea...@priest.com wrote:
Hi,
I have code that works fine when I run it on Python 2.6.5, but I get an "invalid
syntax" error in Python 2.4.3. I'm hoping you can help me fix it.
The line in question splits a chunk of semi-colon separated words into separate
elements.
rgenre = re
On 2:59 PM, David Hutto wrote:
Ok, Let me restate and hopefully further clarify.
1. I have a field for a wxpython app using matplotlib to display
2. I have a sqlite3 db which I'm retrieving information from
3. The sqlitle data is returned as unicode: u'field'
4. The portion of the matplotlib
On 2:59 PM, Tim Johnson wrote:
My intention is to set a class attribute so that any number of
instantiations will have this value.
the module is tmpl.py. the class is tmpl.
if from the script I do this:
import tmpl
tmpl.tmpl.templatepath = kbLib.templatepath
I get error message:
'module' obje
On 2:59 PM, Albert-Jan Roskam wrote:
Hi all,
How can I update a csv file? I've written the code below, but it does
not work ("Error: line contains NULL byte"). I've never tried opening a
file in read and write mode (r+) at the same time before, so I suspect
that this is the culprit. Should I
On 2:59 PM, Richard D. Moores wrote:
It's great to have you chime in, Steven. I do wish you would stop
pulling your punches, however. ;)
On Fri, Oct 22, 2010 at 17:23, Steven D'Aprano wrote:
On Sat, 23 Oct 2010 12:42:50 am Richard D. Moores wrote:
So I wrote a function:
def float2n_decimals
On 2:59 PM, Josep M. Fontana wrote:
Hi,
As I said in another message with the heading "Using contents of a
document to change file names", I'm trying to learn Python "by doing"
and I was working on a little project where I had to change the names
I run this and I don't get any errors. The name
On 2:59 PM, Richard D. Moores wrote:
On Sun, Oct 24, 2010 at 13:29, Emile van Sebille wrote:
From people who would know found at
http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.triangular.html
"""The triangular distribution is often used in ill-defined problems where
the u
On 2:59 PM, Roy Hinkelman wrote:
I am posting here as well as a PHP list since I am now getting an odd python
error.
Rance: Thanks for the note. I get the same error with system or exec or
passthru
Now, this is very strange.
I made the command line string more explicit, and now it recognizes
On 2:59 PM, Alan Gauld wrote:
"Steven D'Aprano" wrote
is actually being executed. There are very few programming tasks
harder than trying to debug code that doesn't actually contain any
bugs, or contains bugs different from the ones you are seeing,
because the code you are actually executin
On 11/1/2010 8:48 AM, Josep M. Fontana wrote:
Thanks a lot Dave and Joel,
You call re.sub(), but don't do anything with the result.
Where do you call os.rename() ?
Yes, indeed, as you suggested what was missing was the use of
os.rename() to apply the substitution to the actual file names. I
On 11/1/2010 1:53 PM, Josep M. Fontana wrote:
Hi Dave,
On Mon, Nov 1, 2010 at 2:38 PM, Dave Angel wrote:
(You top-posted, so I had to remove the out-of-order earlier portion.)
I've not tried to run the code, but I think I can see the problem. Since
you never assign 'year' in
On 2:59 PM, Samuel de Champlain wrote:
I am learning python. To practice, I am coding a hangman application in
pyGTK.
Here are my imports:
import pygtk
pygtk.require('2.0')
import gtk
import random
Here is my main class:
class PenduGTK:
Inside the class is a method with a bit of code:
d
On 2:59 PM, Matthew Denaburg wrote:
Hi,
OK, so I have a question for you math people: I am trying to solve a
quartic equation (Ax^4 + Bx^3 + Cx^2 + Dx + E) using Ferrari's Method, which I
found on Wikipedia at this location.
I'm using Python 3.1.2 (on Mac OS X 10.6, in case th
When I run this code (I'm also a noob) I get this result:-
[evaluate lines 1-22 from untitled-1.py]
The number of heads was 73
The number of tails was 100
Press the enter key to exit.
# Surely, if flipping a single coin 100 times your total number of heads and
tails should add up to 100
# not
On 2:59 PM, Joe Ohmer wrote:
Hello,
The following code works well but I don't understand why the mysteryEffect code
block changes the picture.
Doesn’t 64*(r/64) just equal r? (Same with g and b.) So this function should
not change the picture at all. But it does! If anyone can explain how and
I don't know what "sufficient numbers" means, but perhaps it's "significant
digits" that was intended. And you have to decide if you want ten digits to the right of the
decimal point, or ten significant digits in the whole number. That determines whether you want to
round decnum2 or the final
mktime() and gmtime() are not inverses of each other. The first assumes local
time, and the latter gmt (or utc). So unless you happen to be in England, and
not in daylight savings time, you'd expect a problem.
mktime() is documented as the inverse of localtime(), according to the docs.
I'd
This is the second post I've seen on this homework assignment. You might look
at the Python List for other ideas.
mktime() and gmtime() are not inverses of each other. The first assumes local
time, and the latter gmt (or utc). So unless you happen to be in England, and
not in daylight savin
I am trying to filter Open Street Map nodes from
http://planet.openstreetmap.org/minute/
... into wikimark up for Yellowikis (http://www.yellowikis.org)
I work from home - but this isn't a homework assignment. :-)
Paul Y
On Mon, Mar 30, 2009 at 5:52 PM, Dave Angel wrote:
This is the s
Christopher Spears wrote:
I want to write a script that takes a list of images and renumbers
them with a user supplied number. Here is a solution I came up while
noodling around in the interpreter:
>>> alist = ["frame.0001.tif","frame.0002.tif","frame.0003.tif"]
>>> new_start = 5000
>>> for x i
Chris Castillo wrote:
Message: 1
Date: Sun, 5 Apr 2009 15:36:09 -0500
From: Chris Castillo
Subject: [Tutor] base n fractional
To: tutor@python.org
Message-ID:
<50e459210904051336v60dfc6ddt280d3c9c8f6e0...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
I need some help c
ALAN GAULD wrote:
> That's a great idea Mr. Gauld!
> But I have no idea how to do that...
> can you maybe write a small example for a newb like me?? pretty please with
cheese on top??
> > > base = pic(file="base.gif")
> > >
> > > Now, I'm just wondering... for the "base.gif" part, would
Alan Gould wrote:
Good idea, I forgot that in Python you can find the full path that way.
Too used to working in C/C++ where the file macro only gives the
filename...
In C++, you wouldn't want the full path to the source file, but the full
path to the .EXE file. That can be gotten in Windo
Dave Angel wrote:
In C++, you wouldn't want the full path to the source file, but the full
path to the .EXE file. That can be gotten in Windows, by using
GetModuleHandle(0), and some other function on that handle. Sorry I
don't remember the name of the second function, but I ha
mbikinyi brat wrote:
Dear ALL,
I have defined variables as below and when I call them using the print
function, I have something discontinous as in pink colour. How do I call it so
that my output should be as in blue
counter=101
miles=1000
name="joe"
print counter
mbikinyi brat wrote:
Dear all,
Here are two functions printme and change quite spaced apart. When executed the output in bold are joined. What can I do so that the results are separate in two blocks?
?
#Function definition is here
def printme(str):
??? "This prints a passed string into this fun
Matt Domeier wrote:
Hello,
I have a series of lists that I need to output into files with a
specific format. Specifically, I need to have line breaks after each
entry of the list, and I need to do away with the ['..'] that
accompany the data after I transform the list into a string. Can
sudhanshu gautam wrote:
2.Now another file in which I want to extend that same parent class is here
.First code running successfully but in another one having problem
'This another source code will represent the new Entry of database'
import title
class Newstudent(Studentdatabase):
def
robert mcquirt wrote:
Hi. I've not been working with Python very long and have run into a puzzling
thing. I'm working on a program that needs to identify the filetype of files
without extensions. Using the file command in the shell works fantastic, as in:
rob...@ubuntu:~$ file -b linu
David wrote:
Hi, I am going through Wesley Chun's book and this is Exercise 8-11;
Write a program to ask the user to input a list of names, format "Last
Name" "comma" "First Name". Write a function that manages the input so
that when/if the user types in the names in the wrong format the err
Matt Herzog wrote:
Should be simple, right? Not for me, heh.
def schmove(src,dst):
... src = '/home/datasvcs/PIG/cjomeda_exp/'
... dst = '/home/datasvcs/PIG/cjomeda_exp_archive/'
... listOfFiles = os.listdir(src)
... for filez in listOfFiles:
... os.s
R K wrote:
Gurus,
I'm trying to write a fairly simple script that finds the number of hours /
minutes / seconds between now and the next Friday at 1:30AM.
I have a few little chunks of code but I can't seem to get everything to piece
together nicely.
import datetime,time
now = datetime.dat
Robert Berman wrote:
Thank you, Christian. This solution was one I was not expecting and am
glad to receive it. It is one I will explore in greater detail later.
Robert
On Wed, 2009-05-20 at 16:44 +0200, Christian Witts wrote:
Robert Berman wrote:
Hi,
Given a list of options: optio
prasad rao wrote:
Hello
It is printing wether the item is callable or not.
I want it to print
sys.getdefaultencoding
ASCII
sys.getfilesystemencoding
mbcs
Like that
Prasad
But when you get to sys.exit(), you'll be terminating your test. In
general, it's not safe to just run through a lis
nikhil wrote:
Hi,
I am learning Python and came across this example in the Python Online
Tutorial (
http://docs.python.org/tutorial/controlflow.html#default-argument-values)
for Default Argument Values.
ex:
def func(a, L=[ ]):
L.append(a)
return L
print func(1)
print func(2)
print func(3)
Gregory Morton wrote:
Looking in the directory for Python, I see no real sign of IDLE anywhere in it.
The reason for why I want it visible is because I plan on storing Python (this
is 3.0.1 by the way) in my USB thumbdrive so I can use and transfer it on other
computers. Is there any logic b
vishwajeet singh wrote:
Hi List,
I am trying to install review board on windows. It fails saying it could not
build PIL 1.1.6 because visual studio was not found on the system and but I
have already installed the PIL 1.1.6 using binaries available on the site
but review board fails to locate
roberto wrote:
On Tue, Jun 2, 2009 at 10:54 AM, roberto wrote:
>>
>> hello,
>> i'd like to ask if there is anything in python which helps to see what
>> variables have been defined and their type and their dimension etc;
>>
>> if any of you has ever used Matlab, i mean something really sim
spir wrote:
Hello,
is there a way to make glob work in a specified dir?
(or is it necessary to use os.chdir first?)
Thank you,
denis
You can hand glob.glob either a relative pathname (in which it's
relative to the current directory), or an absolute pathname.
Eddie wrote:
I'm trying to write a simple factorial program and am unsure at what is
wrong with it. Why Can't I go *factorial = factorial * number* where
factorial and number are both integers?
#Factorial program
print "Factorial finder"
number = input("Please enter a non-negative integer: "
Randy Trahan wrote:
Attached is an error I cannot get to work, I was doing a print concatenation
but it won't let me get past "+ "ibly impressive. " \
(then to next line)
If you had included the sample lines in your message, instead of an
attachment, then it'd be part of the mailing list, a
acfleck wrote:
I'm a Python nubie and having trouble with 3.0.1 on Mac (10.4.11). I
did a default install of MacPython 3.0.1. The IDLE.app works fine, but
from a Terminal window, the 'python' command still gets me V2.5.3 (the
original Apple installed version). A 'python3' command is not
reco
Eddie wrote:
Hi guys,
What would you regard as the best free Python editor to use on Windows
for a new guy? Searching Google i see that there is quite a few out
there and is "VIM" the best one to go with?
Regards
Eddie
This is such a common question on the python forums it ought to be in
karma wrote:
I was playing around with eliminating duplicates in a list not using
groupby. From the two solutions below, which is more "pythonic".
Alternative solutions would be welcome.
Thanks
x=[1,1,1,3,2,2,2,2,4,4]
[v for i,v in enumerate(x) if x[i]!=x[i-1] or i==0]
[x[i] for i in range(l
bob gailer wrote:
Elisha Rosensweig wrote:
> Hi,
>
> How can I determine the directory in which a module is located, from
> within that module?
sys.modules[__name__].__file__
-- Bob Gailer
Or more simply,
__file__
But the OP wanted the directory, which can be extracted with method d
Vincent Davis wrote:
given a class like
class B():
def __init__(self, b1, b2):
??? self.fooa = fooa
??? self.foob = foob
Ok now I have several instances in a list
b1 = B(1, 2)
b2 = B(3, 4)
b3 = B(9, 10)
alist = [b1, b2, b3]
Lets say for each instance of the class I want to print the value of
fo
Joe Python wrote:
I have a generator as follows to do list calculations.
*result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))]*
The above generator, throws '*ZeroDivisionError*' exception if ListA[i] =
0.
Is there a way to say 'Don't divide by ListA[i] if its equal to 0 (wi
Raj Medhekar wrote:
Hi, I need help with the code below. I am trying to pair the list in the hint
with the list of words. However, the list is not matching up correctly. Also
when the correct guess is entered the program just continues without
acknowledging the right answer. Please could y'al
101 - 200 of 1736 matches
Mail list logo