Colin Corr said unto the world upon 2005-03-16 01:38:
Greetings Tutors,
I am having some difficulties with the concept of functions which can
accept an unnamed number of arguments. Specifically, when trying to
write a function that deals with an unnamed number of dictionaries. I
want to be able to
Greetings Tutors,
I am having some difficulties with the concept of functions which can
accept an unnamed number of arguments. Specifically, when trying to
write a function that deals with an unnamed number of dictionaries. I
want to be able to merge any number of dictionaries, while preserving
th
Jacob S. wrote:
Okay, not a very descriptive subject, but here goes...
This is the code
###
from decimal import Decimal as D
Oh come on!
"""Everything is first converted to meters, and then converted to the unit
you want to extend usage.
dic[unit] = (unitto
Quoting "Jacob S." <[EMAIL PROTECTED]>:
> But, I digress--to the problem...
> If I call convert(3,'ft','yd'), I should get Decimal("1")
> instead, I get Decimal("1.195990046301080256481500617")
At the risk of being blindingly obvious ---
ft[0] is lambda x:381*x/1250
yd[1] is lambda x:1250/(1143*
On Mar 16, 2005, at 03:54, jrlen balane wrote:
how would i make this the correct path:
filename = "%s%s.txt" %('C:\Documents and Settings\nyer\My
Documents\Info',time.strftime("%Y%m%d%H%M"))
table_file = open(os.path.normpath(filename),"a")
running on IDLE, i get the following error:
Traceback (mos
how would i make this the correct path:
filename = "%s%s.txt" %('C:\Documents and Settings\nyer\My
Documents\Info',time.strftime("%Y%m%d%H%M"))
table_file = open(os.path.normpath(filename),"a")
running on IDLE, i get the following error:
Traceback (most recent call last):
File "C:/Python23/prac
Okay, not a very descriptive subject, but here goes...
This is the code
###
from decimal import Decimal as D
"""Everything is first converted to meters, and then converted to the unit
you want to extend usage.
dic[unit] = (unittometers,meterstounit)
"""
dic =
> Do you want a container with a range in it, like the list
> [1,2,3,4,5,...,100]:
>
> >>> range(100)
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
[...]
> 92, 93, 94, 95, 96, 97, 98, 99]
Opps. Notice that I did the range 0-99, of course. But it's still the
function that you wan
> Hey I am new at python and i am trying to learn about
> it. I was wondering if you could tell me how to write
> a range to 100. such as 1+2+3+4+5 ect. without
> writing it out.
Do you want a container with a range in it, like the list
[1,2,3,4,5,...,100]:
>>> range(100)
[0, 1, 2, 3, 4, 5, 6
On Mar 16, 2005, at 02:02, Ian Martin wrote:
Hey I am new at python and i am trying to learn about
it. I was wondering if you could tell me how to write
a range to 100. such as 1+2+3+4+5 ect. without
writing it out.
Well, I'm not going to give you the full solution (that'd spoil the
fun), but
Hey I am new at python and i am trying to learn about
it. I was wondering if you could tell me how to write
a range to 100. such as 1+2+3+4+5 ect. without
writing it out.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo
that is exactly what i am looking for, but how would i add this to my
filename???
should i use this:
output_file = open(os.path.join(self.Save_Session.GetValue(),
time.strftime('%Y%m%d%H%M')), 'w')
the self.Save_Session.GetValue() is generated by a dirdialog
Uck,uck, uck, no...
That's what Kent's
On Tue, 15 Mar 2005 [EMAIL PROTECTED] wrote:
> hi Danny, I had no idea Debian split its profiler into a separate
> package in the testing distro. That would explain it, except I am using
> Debian unstable with Debian stable for security packages, as my "more
> /etc/apt/sources.list" output is:
Sheesh. Star wars/programming humour. Better not be any Star Trek
humour, that'll go over my head even further.
On Tue, 15 Mar 2005 22:24:53 +, Max Noel <[EMAIL PROTECTED]> wrote:
>
> On Mar 15, 2005, at 21:59, Liam Clarke wrote:
>
> > On Tue, 15 Mar 2005 17:09:50 +, Max Noel <[EMAIL PR
On Mar 15, 2005, at 21:59, Liam Clarke wrote:
On Tue, 15 Mar 2005 17:09:50 +, Max Noel <[EMAIL PROTECTED]>
wrote:
re.findall returns a list object (as the error message says).
Use name
= x[1] instead. (and be careful, numbering starts from 0, so this code
may contain a Kenobi error)
Liam Clarke wrote:
On Tue, 15 Mar 2005 17:09:50 +, Max Noel <[EMAIL PROTECTED]> wrote:
re.findall returns a list object (as the error message says). Use name
= x[1] instead. (and be careful, numbering starts from 0, so this code
may contain a Kenobi error).
Kenobi as in Obi Wan?
or may
On Tue, 15 Mar 2005 17:09:50 +, Max Noel <[EMAIL PROTECTED]> wrote:
>
> re.findall returns a list object (as the error message says). Use name
> = x[1] instead. (and be careful, numbering starts from 0, so this code
> may contain a Kenobi error).
>
Kenobi as in Obi Wan?
--
'Ther
hi Danny, I had no idea Debian split its profiler into a separate package
in the testing distro. That would explain it, except I am using Debian
unstable with Debian stable for security packages, as my
"more /etc/apt/sources.list" output is:
nike:# more /etc/apt/sources.list
#deb file:///cdrom/
> This is highly unusual! This should have worked without any error
> messages, as both the 'profile' and 'hotshot' modules are part of the
> Standard Library, and should work out of the box.
Hi Tpc,
Oh, wait. The above statement is usually true, unless we're running
something from a Linux dis
On Tue, 15 Mar 2005 [EMAIL PROTECTED] wrote:
> So I tried using the example code verbatim to see if I get the same
> error messages, and I do! When I try "import hotshot.stats" I get:
>
> >>> import hotshot.stats
>
> Traceback (most recent call last):
> File "", line 1, in -toplevel-
> im
hi everyone, to anyone who has profiled their Python code using hotshot; I
designed a test case using hotshot that is basically a stripped down
version of the example code found here:
http://www.python.org/doc/current/lib/hotshot-example.html
So I tried using the example code verbatim to see if I
On Mar 15, 2005, at 17:41, Ron Nixon wrote:
Max:
Thanks that seem to do the trick. One question though,
how do you write a tuple out as a list to a new file
like the example I have in my code
Ron
You mean, all the members of the list, separated by commas, with a new
line at the end? Well, this ma
[EMAIL PROTECTED] said unto the world upon 2005-03-15 04:16:
ok thanks for the help but i did what you said and heres what i got don't
know exactly what i got but here lol
will you help me figer what i got out and the module docs dose not work whem
i go to the browser in opens a window sayi
Hi,
Try this solution.
Create a script named sitecustomize.py into your
python lib directory (i.e /usr/lib/python2.3) and add
the following code :
#---sitecustomize.py---
import sys
sys.setdefaultencoding('latin-1')
See u,
Lja
--- BRINER Cedric <[EMAIL PROTECTED]> wrote:
> python-2.3 apa
Kent:
The code is below. Here's the error message.
Traceback (most recent call last):
File "C:/Python24/reformat.py", line 5, in
-toplevel-
name = x.group(1)
AttributeError: 'list' object has no attribute 'group'
import re
f = open('reformat.txt').read()
pat = re.compile(r"([^\r\n]+)\n
On Mar 15, 2005, at 16:44, Ron Nixon wrote:
Kent:
The code is below. Here's the error message.
Traceback (most recent call last):
File "C:/Python24/reformat.py", line 5, in
-toplevel-
name = x.group(1)
AttributeError: 'list' object has no attribute 'group'
re.findall returns a list object (a
Ron Nixon wrote:
Thanks to all who replied to my post earlier on re's.
I'm still preplexed by why re.search and re.match
works in the code below, but not re.findall.
re.findall is suppose to return all non-voerlapping
occurances of the pattern that matches in this
example, but it returns errors. L
Thanks to all who replied to my post earlier on re's.
I'm still preplexed by why re.search and re.match
works in the code below, but not re.findall.
re.findall is suppose to return all non-voerlapping
occurances of the pattern that matches in this
example, but it returns errors. Looking through th
that is exactly what i am looking for, but how would i add this to my
filename???
should i use this:
output_file = open(os.path.join(self.Save_Session.GetValue(),
time.strftime('%Y%m%d%H%M')), 'w')
the self.Save_Session.GetValue() is generated by a dirdialog
On Tue, 15 Mar 2005 09:41:35 -0600, C
On Tuesday, Mar 15, 2005, at 05:01 America/Chicago,
[EMAIL PROTECTED] wrote:
how am i going to change the filename automaticaly?
for example:
#every 5 minutes, i am going to create a file based on the
data above
for i in range(100)
output_file = file('c:/output' +.join(i) +'.txt
BRINER Cedric wrote:
print uses sys.stdout.encoding to encode unicode strings. You can check what
this is in your cgi with
import sys
print sys.stdout.encoding
didn't know
I think it will work to explicitly encode the unicode string in the encoding you want for the web
page. Try
print content.enc
Hi!
Looking up the ftplib-Module on my Solaris-Box
>>> print sys.version
2.3.3 (#1, Mar 10 2004, 06:25:19)
[GCC 3.3.2]
I get the following doc for retrlines of the FTP-class:
>>> print myFTP.retrlines.__doc__
Retrieve data in line mode.
The argument is a RETR or LIST command.
Øyvind wrote:
I have opened an FTP connection, and use the following to download a logfile:
f = open('c:///web.log','w')
ftp.retrlines('RETR ex050202.log', f.write)
I have also tried with f.writelines.
It works, but not as well as I would like. All the \n's are removed. How
can I download an exact
I have opened an FTP connection, and use the following to download a logfile:
f = open('c:///web.log','w')
ftp.retrlines('RETR ex050202.log', f.write)
I have also tried with f.writelines.
It works, but not as well as I would like. All the \n's are removed. How
can I download an exact copy, so th
Øyvind wrote:
Hello.
I need to query the whois at Ripe.net. It tells me to connect to port 43.
I have found a description how to connect with .Net.
http://www.aspheute.com/english/2825.asp I am not very familiar with
network protocols, but assume this will be no big problem with Python. Can
som
BRINER Cedric wrote:
python-2.3 apache2
hi,
I'm trying to use unicode function into a cgi script with no success.
# cedric.py---
#!/usr/bin/python
import os,sys
import cgi
import cgitb; cgitb.enable()
print "Content-Type: text/html\
"+os.linesep+"\
"+os.linesep+"hipo'potame"
sys.stdout.flus
jrlen balane wrote:
so for example, i have 5 arrays, i can do this (is this correct):
data1[1,2,3,4,5 (and so on)]
data2[1,2,3,4,5 (and so on)]
data3[1,2,3,4,5 (and so on)]
data4[1,2,3,4,5 (and so on)]
data5[1,2,3,4,5 (and so on)]
datas = [data1, data2, data3, data4, data5]
for data in datas:
l
[EMAIL PROTECTED] wrote:
*
I have read but don't under stand how to use pydoc. here what i read
can't figer out how to use it.
One way to use pydoc is to start up a mini web server that delivers module documentation. On
Windows, start the server with Start / Programs / Python / Module Docs.
Robert Storey wrote:
This book is a few years old and was written for Python version 1.5, and
of course I'm using version 2.3, so I'm just wondering if this whole
issue of big numbers is now being handled automatically?
Yes, it is. There have been many changes to Python since 1.5; when you are comf
Hello.
I need to query the whois at Ripe.net. It tells me to connect to port 43.
I have found a description how to connect with .Net.
http://www.aspheute.com/english/2825.asp I am not very familiar with
network protocols, but assume this will be no big problem with Python. Can
someone point me
python-2.3 apache2
hi,
I'm trying to use unicode function into a cgi script with no success.
# cedric.py---
#!/usr/bin/python
import os,sys
import cgi
import cgitb; cgitb.enable()
print "Content-Type: text/html\
"+os.linesep+"\
"+os.linesep+"hipo'potame"
sys.stdout.flush()
content = u'c\xe
Hi!
As far as I can remember, there was a change between some version's of python
of 2.x.
Now there is an automatic conversion from int to long, when it is necessary.
Regards, Ewald
on Tue, 15 Mar 2005 15:06:06 +0800 Robert Storey <[EMAIL PROTECTED]> wrote :
--
42 matches
Mail list logo