> * building a dict of indicies::
>
>positions = dict((item, i) for i, item in enumerate(L))
>
>if positions['A'] < positions['D']:
># do some stuff
>
>You'll only get a gain from this version if you need to do several
> comparisons instead of just one.
Hi Steven,
How To Ask Questions The Smart Way
http://www.catb.org/~esr/faqs/smart-questions.html
--
http://mail.python.org/mailman/listinfo/python-list
Hello
Following part of an database query works fine :
self.cur=con1.cursor
self.cur.execute('select a,b,c,d from t1')
for (a,b,c,d) in self.cur:
print a,b,c,d
but how to do this:
self.cur.execute(sql_select_text_put_in_at_runtime)
for (whatever_was_in_the_select_text_part_of_the_query) i
kpp9c wrote:
> timedelta looks to be just the ticket! bravo, thank you... i guess this
> must be pretty new to Python.
Well, since Python 2.3 (July 2003):
http://www.python.org/doc/2.3.5/whatsnew/node18.html#SECTION000181
:-)
--
Faber
http://faberbox.com/
http://smarking.com/
"DarkBlue" <[EMAIL PROTECTED]> wrote:
> Following part of an database query works fine :
>
> self.cur=con1.cursor
> self.cur.execute('select a,b,c,d from t1')
> for (a,b,c,d) in self.cur:
> print a,b,c,d
>
>
> but how to do this:
>
> self.cur.execute(sql_select_text_put_in_at_runtime)
> for (w
Thank you
Mission accomplished.
Have a nice sunday
Db
--
http://mail.python.org/mailman/listinfo/python-list
Ben C wrote:
...
>
> Why not just:
>
> data = None
> def func(a):
> global data
>
> if not data:
> data = somethingcomplexandcostly()
>
> return simple(data, a)
>
well in the original instance the above reduced to something like
data=None
def func(arg):
global da
John Salerno:
>I always read about how you need to set certain file permissions (for
>cgi files, for example), but it's never been clear to me *how* you do
>this. I know you can run the line
>
>chmod 755 scriptname.py
>
>but *where* do you run this?
This is a Unix/Linux command. You run it in a
> I always read about how you need to set certain file permissions (for
> cgi files, for example), but it's never been clear to me *how* you do
> this. I know you can run the line
>
> chmod 755 scriptname.py
>
> but *where* do you run this? Is this done on your personal system, or on
> the server?
Hi group!
Did anybosy here have some success using the bonobo bindings
to interact with nautilus?
--
Patrick
--
http://mail.python.org/mailman/listinfo/python-list
Alle 19:15, sabato 29 aprile 2006, Fredrik Lundh ha scritto:
> emacs
I didn't like Emacs since the glory day of Amiga. Also vim look pretty rough
for my tastes.
I fill more confortable in Kate, but I don't deny any furter trial. May I'm
gonna reconsidering Emacs :)
F
--
http://mail.python.org/m
"kyo guan" wrote:
> for (i = n; --i >= where; ) /// here, why not use memmove? it would be more
> speed then this loop.
>items[i+1] = items[i];
have you benchmarked this on a wide variety of platforms, or are
you just guessing?
--
http://mail.python.org/mailman/listinfo/python-list
Hi folks!
I created an mmap object like so:
--- snip ---
from mmap import mmap,MAP_ANONYMOUS,MAP_PRIVATE
fl = file('/dev/zero','rw')
mm = mmap(fl.fileno(), 1, MAP_PRIVATE|MAP_ANONYMOUS)
--- snap ---
Now, when I try to resize mm to 10 byte
--- snip ---
mm.resize(10)
--- snap ---
I get an Environme
kpp9c wrote:
> I have a several list of songs that i pick from, lets, say that there
> are 10 songs in each list and there are 2 lists.
>
> For a time i pick from my songs, but i only play a few of the songs in
> that list... now my wife, Jessica Alba, comes home, and i start playing
> from Jessic
On 30/04/2006 11:57 AM, kyo guan wrote:
> Hi :
>
> python list object like a stl vector, if insert a object in the front
> or the middle of it,
> all the object after the insert point need to move backward.
>
> look at this code ( in python 2.4.3)
>
> for (i = n; --i >= where; )
In article <[EMAIL PROTECTED]>,
Edward Elliott <[EMAIL PROTECTED]> wrote:
>Kevin Simmons wrote:
>> I have a python script that prompts the user for input from stdin via a
>> menu. I want to process that input when the user types in two characters
>> and not have to have the user press . As a compa
Hi,
this is to inform you of the release of eric3 3.9.0. This version
includes support for Qt4 and PyQt4. It will be the last major release in
the eric3 line of development. From now on the development effort will
concentrate on eric4, the PyQt4 variant of the IDE. As usual the release
is availabl
Hi.
I have a gui with one frame and 5 panels. The second panel will only
be required in some cases, so I am wondering if there is some way I
can only create this panel in the circumstances where it is required,
confirmed by a simple len(list) > 1
If it is possible, I am wondering how I might go
Is their a command to convert a tuple to string? e.g.
xyz = "Hello", "There"
print xyz
Is their any way of getting print to see xyz as being one string i.e.
"Hello There" rather than "Hello" and "There", despite "Hello" and
"There" being, in reality, seperate?
Thanks in advance,
-- /usr/bin/byt
On 30 Apr 2006 08:32:47 -0700, Byte <[EMAIL PROTECTED]> wrote:
xyz = "Hello", "There"print xyzIs their any way of getting print to see xyz as being one string i.e."Hello There" rather than "Hello" and "There", despite "Hello" and
"There" being, in reality, seperate?
>>> print " ".join(xyz)Hello Th
Kay Schluehr wrote:
>> * building a dict of indicies::
>>
>>positions = dict((item, i) for i, item in enumerate(L))
>>
>>if positions['A'] < positions['D']:
>># do some stuff
>>
>>You'll only get a gain from this version if you need to do several
>> comparisons inste
On Sunday 30 April 2006 17:32, Byte wrote:
> Is their a command to convert a tuple to string? e.g.
>
> xyz = "Hello", "There"
> print xyz
>
> Is their any way of getting print to see xyz as being one string
> i.e. "Hello There" rather than "Hello" and "There", despite "Hello"
> and "There" being, i
> Is their a command to convert a tuple to string? e.g.
>
> xyz = "Hello", "There"
> print xyz
>
> Is their any way of getting print to see xyz as being one string i.e.
> "Hello There" rather than "Hello" and "There", despite "Hello" and
> "There" being, in reality, seperate?
Try
one_big_string =
Great, that works thanks
-- /usr/bin/byte
--
http://mail.python.org/mailman/listinfo/python-list
Daniel Nogradi wrote:
> In short, chmod refers to local files so wherever you run it it will
> refer to files on that machine. You run it simply by typing it in a
> shell as a user who has privilage to perform the operatation, which
> can mean you have to be an owner of the file but if you are roo
I'd like to know how to make the following string:
food
fruit
red
cherry
yellow
banana
meat
pork
foo
bar
baz
qux
Result in a dictionary like this:
{'food': {'fruit': {'red': 'cherry', 'yellow': 'banana'}, 'meat':
'pork'}, 'foo': {'bar': 'baz', 'qux': {}}}
Or something like that
Am Sonntag 30 April 2006 19:26 schrieb veracon:
> -- Keep in mind that I don't want a string, I want a dictionary (but I
> can't figure out how to do it).
The following code does what you want:
>>>
# -*- coding: iso-8859-15 -*-
data = """food
fruit
red
cherry
yellow
banana
meat
por
Ravi Teja wrote:
> How To Ask Questions The Smart Way
> http://www.catb.org/~esr/faqs/smart-questions.html
Actual the parent post on the thread wasn't asking a question. They
were making a somewhat puzzling dangling statement.
"here we discuss the most basic concepts about python"
Where is _her
> I suppose I could write a script that would set the permissions of all
> the files in a particular folder on my computer to 755, but is there a
> Windows equivalent command for chmod to do this? Or am I stuck having to
> do it on the server side?
The chmod has to be executed on the machine th
Roger Miller wrote:
> First note that zipfile is a plain Python module, so reading
> Python.../Lib/zipfile.py will reveal all its secrets.
>
> I don't think it is possible to replace archive members using the
> module. You could copy all the files into a new zip file, replacing the
> ones you want
On 2006-04-30, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> here we discuss the most basic concepts about python.
Yes we do.
As well as the most basic concepts about Usenet.
--
Grant Edwards
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Cameron Laird wrote:
> In article <[EMAIL PROTECTED]>,
> Edward Elliott <[EMAIL PROTECTED]> wrote:
> >Kevin Simmons wrote:
> >> I have a python script that prompts the user for input from stdin via a
> >> menu. I want to process that input when the user types in two characters
> >> and not have t
Fabiano Sidler wrote:
> Hi folks!
>
> I created an mmap object like so:
> --- snip ---
> from mmap import mmap,MAP_ANONYMOUS,MAP_PRIVATE
> fl = file('/dev/zero','rw')
> mm = mmap(fl.fileno(), 1, MAP_PRIVATE|MAP_ANONYMOUS)
> --- snap ---
>
> Now, when I try to resize mm to 10 byte
> --- snip ---
>
[EMAIL PROTECTED] wrote:
> Hi.
>
> I have a gui with one frame and 5 panels. The second panel will only
> be required in some cases, so I am wondering if there is some way I
> can only create this panel in the circumstances where it is required,
> confirmed by a simple len(list) > 1
>
> If it is
timw.google wrote:
> I just downloaded the pyodbc source to try and install on my Linux FC3
> box. I see that there is a setup.py file, but when I try to do a
> 'python setup.py build' (or just 'python setup.py') I get
>
> Traceback (most recent call last):
> File "setup.py", line 27, in ?
>
> > In short, chmod refers to local files so wherever you run it it will
> > refer to files on that machine. You run it simply by typing it in a
> > shell as a user who has privilage to perform the operatation, which
> > can mean you have to be an owner of the file but if you are root you
> > can d
On 30 Apr 2006 00:48:47 -0700, Ravi Teja wrote:
> How To Ask Questions The Smart Way
> http://www.catb.org/~esr/faqs/smart-questions.html
Damn, that's one of the best respones ever. :)
WTG.
Oh, and I'm not being sarcastic. That's a truly useful set of ideals. It's
now joined my short and distin
Scott David Daniels wrote:
> It is not currently possible to delete or replace individual elements
> in a zip file, nor (in all likelihood) would you want to do so. It
> would require having the zip[ file in a broken state for some time
> as you copy data from one area of the zip to another.
If
John Salerno wrote:
> Thanks, but I'm still a little confused. Since I'm running Windows
You misplaced your period, it goes at the end of that line. ;)
> assume that I can't run the chmod line on my own computer.
Sure you can, install cygwin. chmod only affects files on your computer,
and won'
gregarican wrote:
>> How To Ask Questions The Smart Way
>> http://www.catb.org/~esr/faqs/smart-questions.html
>
> Actual the parent post on the thread wasn't asking a question. They
> were making a somewhat puzzling dangling statement.
Maybe it's time for the sequel, How To Make Smart Statements
Daniel Nogradi wrote:
> I have next to zero experience with windows but as far as I know
> windows doesn't have file permissions at all (anyone, please correct
> me if I'm wrong :)) so in windows land it doesn't make any sense to
> "change file permissions".
Actually Windows has a quite good perm
Daniel Nogradi wrote:
> I have next to zero experience with windows but as far as I know
> windows doesn't have file permissions at all (anyone, please correct
> me if I'm wrong :)) so in windows land it doesn't make any sense to
> "change file permissions". Even if it has some sort of a notion of
HELP!!
All I need to do is to create a file in a folder. I am running Abyss WEB
server and Python. and googling many sites has taught me how to create a
file in a folder. BUT. I need to do this from a WML file - This is proving
difficult...
I can setup an index.wml and a deck of cards. Each ca
Is there a way to measure how much memory a data structure use? For
instance, what is the footprint of a particular list object like
[0,1,2,3,4,5,6,7,8,9]?
--
http://mail.python.org/mailman/listinfo/python-list
For anyone interested, here's a blog entry I've added over at the
Tutorial Wiki:
As mentioned by effbot in the previous post I've put together a
suggested alternative factoring of the Tutorial
here(http://pytut.infogami.com/gerard_refactor). At the minute i
I want to process large binary files (>2GB) in Python. I have played
around with prototypes in pure Python and profiled the code. Most of
the time seems to be spent converting back and forth to and from strings
using the struct module. Is there a way to directly read into an array
of integer
On 2006-04-30, David Lees <[EMAIL PROTECTED]> wrote:
> I want to process large binary files (>2GB) in Python. I have played
> around with prototypes in pure Python and profiled the code. Most of
> the time seems to be spent converting back and forth to and from strings
> using the struct modul
Grant Edwards wrote:
> On 2006-04-30, David Lees <[EMAIL PROTECTED]> wrote:
>
>>I want to process large binary files (>2GB) in Python. I have played
>>around with prototypes in pure Python and profiled the code. Most of
>>the time seems to be spent converting back and forth to and from strings
David Lees <[EMAIL PROTECTED]> wrote:
> I want to process large binary files (>2GB) in Python. I have played
> around with prototypes in pure Python and profiled the code. Most of
> the time seems to be spent converting back and forth to and from strings
> using the struct module. Is there a wa
Daniel Nogradi wrote:
> This depends on your arrangements with your web server provider.
> Perhaps you are allowed to ssh into that machine, perhaps not, you
> need to ask your provider. In case you can use ssh, then you can log
> in with putty (an ssh client for windows, grab it from here:
> http
I have this:
subdomain = raw_input('Enter subdomain name: ')
path = r'C:\Documents and Settings\John Salerno\My Documents\My
Webs\1and1\johnjsalerno.com\' + subdomain
Obviously the single backslash at the end of 'path' will cause a
problem, and escaping it with a backslash seems to fix this pr
Hi everyone, sorry, this post is a bit off topic. I posted this on a
devel xul thread on the mozilla groups but didn't get a response. My
hope is that some of you may have interest in this and have tried it
yourself.
I've been trying to get xulrunner compiled with python (in windows) but
have be
# Create new subdomain directory (with subdirectories) in my 1and1 folder
import os
import sys
subdirs = [r'\cgi-bin', r'\images', r'\styles']
#if len(sys.argv) == 1:
# subdomain = raw_input('Enter subdomain name: ')
#else:
# subdomain = sys.argv[1]
try:
subdomain = sys.argv[1]
except
John Salerno wrote:
Most FTP servers do allow to use chmod in a ftp session, although you're
client must support it. See for example a cli ftp client (and server) on
FreeBSD.
> [EMAIL PROTECTED]:~$ ftp ftp.xs4all.nl
> Connected to ftp2.xs4all.nl.
> 220 XS4ALL ftpd DCLXVI
> Name (ftp.xs4all.nl:
I'm pleased to announce the 0.9.0a1 release of nose, a test runner that
brings py.test convenience to unittest, without resorting to (too much)
magic.
nose 0.9 includes a host of new features, as well as numerous
backwards-incompatible changes to interfaces and implementation. For
this reason, I'm
I'm pleased to announce the 0.9.0a1 release of nose, a test runner that
brings py.test convenience to unittest, without resorting to (too much)
magic.
nose 0.9 includes a host of new features, as well as numerous
backwards-incompatible changes to interfaces and implementation. For
this reason, I'm
I am getting this error when I try to run the code below
f = open("~/m", "r")
print f.read()
:~$ python python/my.py
Traceback (most recent call last):
File "python/my.py", line 1, in ?
f = open("~/m", "r")
IOError: [Errno 2] No such file
how would i use python to find colors and click on them without
actually moving the mouse
--
http://mail.python.org/mailman/listinfo/python-list
Gary Wessle wrote:
> I am getting this error when I try to run the code below
>
>
> f = open("~/m", "r")
> print f.read()
>
>
>
> :~$ python python/my.py
> Traceback (most recent call last):
> File "python/my.py", line 1, in ?
> f = open("
John Salerno wrote:
> Obviously the single backslash at the end of 'path' will cause a
> problem, and escaping it with a backslash seems to fix this problem, but
> how does escaping work when I already have it as a raw string?
see the first two items here:
http://www.ferg.org/projects/python_gotc
John J. Lee wrote:
> "André" <[EMAIL PROTECTED]> writes:
> [...]
>
>>I would like to use a browser (e.g. Firefox) as a simple GUI
>>"framework". Note that this is to be done on a single user machine, so
>>the question of sandboxing is not really relevant here.
>
> [...]
>
>>My ultimate goal wou
"John Salerno" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I have this:
>
> subdomain = raw_input('Enter subdomain name: ')
>
> path = r'C:\Documents and Settings\John Salerno\My Documents\My
> Webs\1and1\johnjsalerno.com\' + subdomain
For any direct use of paths within Python (
Alex Martelli wrote:
> David Lees <[EMAIL PROTECTED]> wrote:
>
>> I want to process large binary files (>2GB) in Python. I have played
>> around with prototypes in pure Python and profiled the code. Most of
>> the time seems to be spent converting back and forth to and from strings
>> using the
I want my Python program to invoke a compiled C program, and capture the
text output.
Here's a fragment from a program that works, using subprocess.Popen:
p = Popen(execName, stdout=PIPE)
while(1):
line = p.stdout.readline() # get next line
outfile.write(line)
(The
Hi John!
About the path and the \'s, take a look at the os.path.join function.
The function is smart enough to add the correct slash when joining
directories.
Dave
--
http://mail.python.org/mailman/listinfo/python-list
DarkBlue wrote:
> Chris wrote:
>
>
>>How do I find and print to screen the IP address of the computer my
>>python program is working on?
>
>
> def readip():
> import re, urllib
> f = urllib.urlopen('http://checkip.dyndns.org')
> s = f.read()
> m = re.search('([\d]*\.[\d]*\.[\d]*\.[\d]*)', s
Regarding this expression: 1 << x
I had a bug in my code that made x become Very Large - much larger than
I had intended. This caused Python, and my PC, to lock up tight as a
drum, and it appeared that the Python task (Windows XP) was happily and
rapidly consuming all available virtual memory.
P
Edward Elliott wrote:
> John Salerno wrote:
>> Obviously the single backslash at the end of 'path' will cause a
>> problem, and escaping it with a backslash seems to fix this problem, but
>> how does escaping work when I already have it as a raw string?
>
> see the first two items here:
> http://
Dave Jones wrote:
> Hi John!
>
> About the path and the \'s, take a look at the os.path.join function.
> The function is smart enough to add the correct slash when joining
> directories.
>
> Dave
Interesting, thanks! I was reading about the normcase() function, but
your suggestion might be bett
John Salerno wrote:
> Dave Jones wrote:
>> Hi John!
>>
>> About the path and the \'s, take a look at the os.path.join function.
>> The function is smart enough to add the correct slash when joining
>> directories.
>>
>> Dave
>
> Interesting, thanks! I was reading about the normcase() function, but
Rune Strand wrote:
> Is there a way to measure how much memory a data structure use? For
> instance, what is the footprint of a particular list object like
> [0,1,2,3,4,5,6,7,8,9]?
i have a note to try this, but haven't got around to it, if you want to
blog/post
http://pysizer.8325.org/
--
htt
[EMAIL PROTECTED] wrote:
>
>I am creating a small gui using wxGlade and wxPython. I am using a
>radio button, and the text next to the options needs to be over two
>lines. I tried using a \n character, but it seems to get ignored.
>
>Looking around in the various wikis and the example code also
hello, i have another problem i feel that i have to be missing
something.. Basically, i've written a recursive function to find all
the prime up to a number (lim).. here is the function:
The function basically takes in a list of all the prime number found,
it takes the next number to be tested for
On 1/05/2006 12:55 PM, [EMAIL PROTECTED] wrote:
> Regarding this expression: 1 << x
>
> I had a bug in my code that made x become Very Large - much larger than
> I had intended. This caused Python, and my PC, to lock up tight as a
> drum, and it appeared that the Python task (Windows XP) was happ
Hi All,
I'm having a problem with Stani's Python Editor (SPE) that I'm hoping
somebody has run into before. If I create a simple hello world
program:
print "hello"
and try and run it in winpdb via the SPE command ALT-F9, the program
does not launch and the following results (It's at the bottom):
On 1/05/2006 2:52 PM, [EMAIL PROTECTED] wrote:
> hello, i have another problem i feel that i have to be missing
> something.. Basically, i've written a recursive function to find all
> the prime up to a number (lim).. here is the function:
>
> The function basically takes in a list of all the prim
[EMAIL PROTECTED] wrote:
> The function basically takes in a list of all the prime number found,
> it takes the next number to be tested for (next) and the limit it will
> go up to. It divide next by the list of previous prime numbers if next
> is not bigger than lim, count up all the times where i
77 matches
Mail list logo