[EMAIL PROTECTED] wrote:
> Hi - I want to take something like ...
>
> lstIn = []
> lstIn.append({'COM_AUTOID': 1, 'PRG_AUTOID': 10, 'LEA_AUTOID': 1000})
> lstIn.append({'COM_AUTOID': 1, 'PRG_AUTOID': 11, 'LEA_AUTOID': 2000})
> lstIn.append({'COM_AUTOID': 1, 'PRG_AUTOID': 11, 'LEA_AUTOID': 2001})
>
Kevin F wrote:
> I have the following script:
>
> emails = []
> for msg in messagesInfo:
> msgNum = int(msg.split()[0])
> msgSize = int(msg.split()[1])
> if(msgSize < 2):
> message = server.retr(msgNum)[1]
> Message = join(message, "\n")
> ema
kpp9c wrote:
> I have a question... and ... whew ... i am gonna be honest, i haven't
> the slightest clue how to even start ... i am not sure if i used up all
> my good will here or can take a mulligan.. i love to try to at least
> post some lame broken code of my own at first... but like i said,
Gerard Flanagan wrote:
> kpp9c wrote:
>
> > I have a question... and ... whew ... i am gonna be honest, i haven't
> > the slightest clue how to even start ... i am not sure if i used up all
> > my good will here or can take a mulligan.. i love to try to at least
>
Hello all
Some basic unix questions which pure laziness prevents me from googling
for. Anyone feeling charitable? I'm using FreeBSD 6.0:
* To create an empty __init__.py file I do 'vim __init__.py' then
immediately exit vim, is there a shell or vim command which will create
an empty file without
Kun wrote:
> i have the following code:
>
> --
> import smtplib
>
> from email.MIMEText import MIMEText
> fp = open('confirmation.txt', 'rb')
> msg = MIMEText(fp.read())
>
> From = '[EMAIL PROTECTED]'
>
> msg['Subject'] = 'Purchase Confirmation'
> msg ['From'] = Fr
John Salerno wrote:
> Now that I've learned much of Python, I'm sort of stuck with what to do
> with it. I'm not a professional programmer, so I don't really have a use
> for Python now. But I really want to come up with some neat uses for it
> (for fun, and so I don't just start forgetting it rig
Fredrik Lundh wrote:
> Ed Singleton wrote:
>
> > I'd suggest adding some sort of guidance page so that people know
> > roughly what's expected. IE can they just add questions and comments
> > into the text, hoping that someone more knowledgeable will sort it out
> > (or delete it).
>
> I've added
In the hope that it may be useful, a simple Html Generator:
http://gflanagan.net/site/python/htmlbuilder/htmlbuilder.py
It requires 'elementtree' :
http://www.effbot.org/zone/element-index.htm
Example:
html = HtmlBuilder( doctype='strict')
page = html.page('Test Page')
page.comm
Gerard Flanagan wrote:
> In the hope that it may be useful, a simple Html Generator:
>
> http://gflanagan.net/site/python/htmlbuilder/htmlbuilder.py
>
> It requires 'elementtree' :
> http://www.effbot.org/zone/element-index.htm
>
> Example:
>
>
Steve R. Hastings wrote:
> Therefore, I propose that all() should work as if it were written this way:
> def all(S):
> ret_val = False
>
> for x in S:
> ret_val = True
> if not x:
> return False
>
> return ret_val
>
> Comments?
Ant wrote:
> all(list) simp
Tomi Lindberg wrote:
>
> # A die with n faces
> D = lambda n: [x+1 for x in range(n)]
>
That can be written:
D = lambda n : range(1,n+1)
Gerard
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi there,
>
> I'm new to Python, but know other scripting and programming languages.
> I
> want to develop a script which will receive emails with attachments
> from my POP3 account, perform certain actions on it and email it back
> to someone else.
>
> However, I'm not
John Salerno wrote:
> Michael Spencer wrote:
>
> > itertools.groupby makes this very straightforward:
>
> I was considering this function, but then it seemed like it was only
> used for determing consecutive numbers like 1, 2, 3 -- not consecutive
> equivalent numbers like 1, 1, 1. But is that not
[EMAIL PROTECTED] wrote:
> Gerard,
>
> I tried to run your code but my interpreter couldn't locate the
> maildocument module. Is it included in Python standart library or
> should I install it from other place?
>
> Thanks,
> Tomer
Sorry Tomer,
I was just suggesting you read it through as an exam
John Salerno wrote:
> I get this internal error message when I try to access a PSP page:
>
> "Invalid command 'PythonHandler', perhaps mis-spelled or defined by a
> module not included in the server configuration"
>
> So it seems that mod_python is not fully configured yet to handled PSP
> pages.
Kun wrote:
> i have a python cgi script that displays tables from a mysql database in
> html.
>
> the problem is, i want to use excel's web query to pull this data and
> the web query doesn't read .py files.
>
> thus i am wondering what is the easiest way to just turn my .py html
> output into a .
News wrote:
> OT: I saw several references to "OP". What does this mean?
It's a TOOTKA :-)
You - The Original Post/Poster.
Gerard
--
http://mail.python.org/mailman/listinfo/python-list
fyleow wrote:
> Hi guys,
>
> I'm a student/hobbyist programmer interested in creating a web project.
> It's nothing too complicated, I would like to get data from an RSS
> feed and store that into a database. I want my website to get the
> information from the database and display parts of it dep
Phlip wrote:
Consider these two python modules:
aa.py
def a():
print '?'
bb.py
import aa
def bb():
aa.a()
bb()
How do I make the print line emit the filename of bb.py? (It could be
anything.)
Possibly not very reliable in every situation (doctests, other pythons,
...) but this i
Steven D'Aprano wrote:
I have a series of subclasses that inherit methods from a base class, but
I'd like them to have their own individual docstrings. The obvious
solution (other than copy-and-paste) is this:
class Base(object):
colour = "Blue"
def parrot(self):
"""docstring
Peng Yu wrote:
For example, the long string is 'abcabc' and the given string is
'abc', then 'abc' appears 2 times in 'abcabc'. Currently, I am calling
'find()' multiple times to figure out how many times a given string
appears in a long string. I'm wondering if there is a function in
python which
alex23 wrote:
Gerard Flanagan wrote:
def count(text, *args):
Other than the ability to handle multiple substrings, you do realise
you've effectively duplicated str.count()?
I realise that calling this count function with a single argument would
be functionally identical to ca
Paddy O'Loughlin wrote:
Hi,
I was wondering if there was a shorthand way to get a reference to a
method object from within that method's code.
Take this code snippet as an example:
import re
class MyClass(object):
def find_line(self, lines):
if not hasattr(MyClass.do_work, "matche
Alan Harris-Reid wrote:
In the Python.org 3.1 documentation (section 20.4.6), there is a simple
“Hello World” WSGI application which includes the following method...
def hello_world_app(environ, start_response):
status = b'200 OK' # HTTP Status
headers = [(b'Content-type', b'text/plain; charset
On 2/4/2010 7:05 AM, Shashwat Anand wrote:
I want to calculate areas.
like for two circles (0, 0) and (0, 1) : the output is '1.228370'
similarly my aim is to take 'n' co-ordinates, all of radius '1' and
calculate the area common to all.
The best I g
Gary Herron wrote:
Gerard Flanagan wrote:
A brute force approach - create a grid of small squares and calculate
which squares are in all circles. I don't know whether it is any
better than monte-carlo:
That's just what the monte-carlo method is -- except the full family of
m
Arnaud Delobelle wrote:
"Alf P. Steinbach" writes:
* Chris Rebert:
On Sun, Feb 7, 2010 at 5:05 PM, T wrote:
Ok, just looking for a sanity check here, or maybe something I'm
missing. I have a class Test, for example:
class Test:
def __init__(self, param1, param2, param3):
self.pa
Klaus Neuner wrote:
Hello,
I am writing a program that analyzes files of different formats. I
would like to use a function for each format. Obviously, functions can
be mapped to file formats. E.g. like this:
if file.endswith('xyz'):
xyz(file)
elif file.endswith('abc'):
abc(file)
...
Y
david jensen wrote:
... and of course i screwed up my outcomes... that should read
outcomes=[[4,3,8,3,5],[3,4,8,3,5],[2,5,8,3,5],[1,6,8,3,5],[0,7,8,3,5]]
abstracting the given algorithm:
def iterweights(N):
d = 1.0/(N-1)
for i in xrange(N):
yield i*d, (N-1-i)*d
def iterpart
Josh English wrote:
Chris,
Thanks. This worked for the attributes, but I think the tactic is
still misleading. There are child elements I can't quite determine how
to deal with:
Analog Science Fiction and Fact
Analog
Science Fiction
First Contact
Hard Science Fiction
wheres pythonmonks wrote:
This should be trivial:
I am looking to extract the first non-None element in a list, and
"None" otherwise. Here's one implementation:
x = reduce(lambda x,y: x or y, [None,None,1,None,2,None], None)
print x
1
I thought maybe a generator expression would be better,
sajuptpm wrote:
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)),
(('y','x'),(3,0))] and postion of values in the tuple change
dynamicaly. I need a way to access correct value even if change in
position.
from itertools import starmap, izip, imap
list(imap(dict, starmap(izip, d)
On 7 Sep, 07:42, sajuptpm wrote:
> More details
> I have a list of tuples l = [((cpu_util,mem_util),(disk_util)),
> ((cpu_util,mem_util),(disk_util))]
> ie, l = [((30,50),(70)), ((50,20),(20))]
>
> l.sort(key=lambda x:(-x[0][0], x[1][0])) # sorting cpu_util asc and
> disk_util desc
>
> suppose i c
301 - 334 of 334 matches
Mail list logo