Îʸö¹ØÓÚemuleµÄÎÊÌâ

2005-06-25 Thread Denton
近日找个东西,最后在emule上找到了,还只有一个源 

排队等了半天也没轮到.,最后找了个坛子去求档了

平日很少用emule  想问问emule排队和积分的关系

是不是积分是一对一的,并不是按自己总的上传下载量来计算的?

如果对方不从我这里下载东西,我只能通过排队时间来提高自己的积分?

我给其他人的上传量无法改变我在对方的积分�?


-- 
http://mail.python.org/mailman/listinfo/python-list

[help] how to generate a empty ".MDB" file using python

2006-01-14 Thread Denton
Hi all:
I working in MS window environment. Now I want to use a python
script to import some data from CSV file to MDB file. 
but I have some  problems about creating MDB file in DAO.

I am using attached code , but the last line seems invalid.
Does anyone could help me.  Thanks!

import win32com.client
eng=win32com.client.Dispatch("DAO.DBEngine.36")
eng.CreateDatabase("d:\\temp.mdb")



Regards 
Denton
-- 
http://mail.python.org/mailman/listinfo/python-list


Integrating a code generator into IDLE

2008-06-01 Thread Sam Denton
Code generators seem to be popular in Python. 
(http://www.google.com/search?q=python+code-generator)


I have one that I'd like to integrate into IDLE.  Ideally, I'd like to 
(1) have a new file type show up when I use the File/Open dialog, and 
(2) have a function key that lets me run my generator against the file, 
just like F5 lets me run my Python code; ideally, I'd like to re-purpose 
the F5 key to be file-type aware.  I've got a simple extension written 
that uses the F6 key to "compile" my files, but two goals I've listed 
seem a bit beyond me.  Does anyone have any advice/pointers?  Or is one 
or both ideas impractical?  Thanks!

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python and Flaming Thunder

2008-06-07 Thread Sam Denton

John Salerno wrote:
"Dave Parker" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On May 20, 7:05 pm, Collin <[EMAIL PROTECTED]> wrote:

---
For example, consider the two statements:

 x = 8
 x = 10

The reaction from most math teachers (and kids) was "one of those is
wrong because x can't equal 2 different things at the same time".
---

Aw, come on. I'm a novice programmer but even after reading the most basic 
of introductions to a programming language I can tell that x is being 
assigned one value, then another.


I've long believed that '=' should be banned from programming languages. 
 Use '==' for equality tests, and ':=' for assignments.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Need help porting Perl function

2008-06-07 Thread Sam Denton

kj wrote:

Hi.  I'd like to port a Perl function that does something I don't
know how to do in Python.  (In fact, it may even be something that
is distinctly un-Pythonic!)

The original Perl function takes a reference to an array, removes
from this array all the elements that satisfy a particular criterion,
and returns the list consisting of the removed elements.  Hence
this function returns a value *and* has a major side effect, namely
the target array of the original argument will be modified (this
is the part I suspect may be un-Pythonic).


The two solutions thus far use the .index() method, which itself runs in 
O(n) time.  This means that the provided functions run in O(n^2) time, 
which can be a problem if the list is big.  I'd go with this:


def partition(alist, criteria):
list1, list2 = [], []
for item in alist:
if criteria(item):
list1.append(item)
else:
list2.append(item)
return (list1, list2)

def mod(alist, criteria=lambda x: x % 2 == 0):
alist[:], blist = partition(alist, criteria)
return blist


>>> partition(range(10), lambda x: x % 2 == 0)
([0, 2, 4, 6, 8], [1, 3, 5, 7, 9])
>>> l=range(10)
>>> mod(l)
[1, 3, 5, 7, 9]
>>> l
[0, 2, 4, 6, 8]
--
http://mail.python.org/mailman/listinfo/python-list


Re: simple question on list manipulation from a newbie

2008-06-07 Thread Sam Denton

Sengly wrote:

Dear all,

I am working with wordnet and I am a python newbie. I'd like to know
how can I transfer a list below

In [69]: dog
Out[69]:
[{noun: dog, domestic_dog, Canis_familiaris},
 {noun: frump, dog},
 {noun: dog},
 {noun: cad, bounder, blackguard, dog, hound, heel},
 {noun: frank, frankfurter, hotdog, hot_dog, dog, wiener, wienerwurst,
weenie},
 {noun: pawl, detent, click, dog},
 {noun: andiron, firedog, dog, dog-iron}]

to a list like this with python:

[dog, domestic_dog, Canis_familiaris,
frump, dog,
dog,
cad, bounder, blackguard, dog, hound, heel,
frank, frankfurter, hotdog, hot_dog, dog, wiener, wienerwurst,
weenie},
pawl, detent, click, dog},
andiron, firedog, dog, dog-iron]


I can't help you with the formatting, but here's a solution using Python 
data structures:


>>> alist = [
{'noun': ('dog', 'domestic_dog', 'Canis_familiaris')},
{'noun': ('frump', 'dog')},
{'noun': ('dog',)},
{'noun': ('cad', 'bounder', 'blackguard', 'dog', 'hound', 'heel')},
{'noun': ('frank', 'frankfurter', 'hotdog', 'hot_dog', 'dog', 
'wiener', 'wienerwurst', 'weenie')},

{'noun': ('pawl', 'detent', 'click', 'dog')},
{'noun': ('andiron', 'firedog', 'dog', 'dog-iron')},
]

>>> merged = {}
>>> for d in alist:
for key, value in d.iteritems():
merged.setdefault(key, []).extend(value)

>>> merged
{'noun': ['dog', 'domestic_dog', 'Canis_familiaris', 'frump', 'dog', 
'dog', 'cad', 'bounder', 'blackguard', 'dog', 'hound', 'heel', 'frank', 
'frankfurter', 'hotdog', 'hot_dog', 'dog', 'wiener', 'wienerwurst', 
'weenie', 'pawl', 'detent', 'click', 'dog', 'andiron', 'firedog', 'dog', 
'dog-iron']}

--
http://mail.python.org/mailman/listinfo/python-list