Ric Da Force wrote:
> Hi,
>
> I have a string such as 'C1, C2, C3'. Without assuming that each bit of
> text is of fixed size, what is the easiest way to change this list so that
> it reads:
> 'C1, C2 and C3' regardless of the length of the string.
>
> Regards and sorry for the newbie questio
--- Mike Meyer <[EMAIL PROTECTED]> wrote:
> Remember that what we're suggesting is just syntactic sugar.
BTW: That's true for all high-level language constructs. You could do
everything in machine language. A good language is the sum of lots of syntactic
sugar... selected with taste. :)
> You can
Hi,
I have a string such as 'C1, C2, C3'. Without assuming that each bit of
text is of fixed size, what is the easiest way to change this list so that
it reads:
'C1, C2 and C3' regardless of the length of the string.
Regards and sorry for the newbie question,
Ric
--
http://mail.python.or
[EMAIL PROTECTED] wrote:
> However, I'd like to add attribute access (magically), so I can do
> this:
>
> v = Vector((1,2,3))
> print v.x
> print v.y
> print v.z
>
> as well as:
>
> print v[0]
> print v[1]
> print v[2]
>
> Has anyone got any ideas on how this might be done?
>>> class Vector(
Hello there,
I need some thoughts about a web application that i am dreaming
and drooling about in python. I want a search page to look exactly like
Google. But when i press the search button, it should search a database
in an rdbms like Oracle and provide results.
For example, i
Replying to myself... how sad.
On Tue, 12 Jul 2005 15:41:46 +1000, Steven D'Aprano wrote:
> That wasn't clear from his post at all. If he had explained what he
> wanted, I wouldn't have wasted my time explaining what he already knew.
On reading it, that came across more snarky than I intended. S
I know its been done before, but I'm hacking away on a simple Vector
class.
class Vector(tuple):
def __add__(self, b):
return Vector([x+y for x,y in zip(self, b)])
def __sub__(self, b):
return Vector([x-y for x,y in zip(self, b)])
def __div__(self, b):
return Ve
ç8GûÏßåÍX¬9ZÕ½4ÃYËÖ4ç!ÅðÓu©xò
{ÛYt8°¨Y2fÚ©
L£µñkUpø}RÈ>®©t¶ûÁÂÈcè¾ùúñhL·æ§ðwUĹm^ÈR&«Ài5¸º5¸*ë7ñLi)'ÏtY»jïf2J\ wCê}wW'µæ`;>
--
http://mail.python.org/mailman/listinfo/python-list
I have released interval-0.2.1 at
http://members.cox.net/apoco/interval/. IntervalSet and
FrozenIntervalSet objects are now (as far as I can tell) functionality
equivalent to set and frozenset objects, except they can contain
intervals as well as discrete values.
Though I have my own unit tes
Hello there,
I need some thoughts about a web application that i am dreaming
and
drooling about in python. I want a search page to look exactly like
Google. But when i press the search button, it should search a database
in an rdbms like Oracle and provide results.
For example, i
ChrisH wrote:
> Oh. The one other thing I forgot to mention is that the data needs to be
> already updated every 10 minutes or so automatically.
You know, this is the most concise example of feature-creep in a
specification that I've ever seen.
--
http://mail.python.org/mailman/listinfo/python-
On Mon, 11 Jul 2005 13:54:05 +0200, Aaron Bingham wrote:
>> Two dicts are equal if they have the same keys and the same values.
>
> That is what I would expect, but where is that documented? Also,
> where is the behavior of the much less obvious dictionary methods
> __ge__, __gt__, __le__, __lt_
[David Isaac]
> > Why don't tuples support an index method?
> > It seems natural enough ...
[Peter Hansen]
> This question has been posed several (many?) times in the past. See the
> archives for more detail, but basically the answer that is usually given
> is this:
>
> Tuples are intended to be
On Mon, 11 Jul 2005 22:10:33 -0400, "Colin J. Williams" <[EMAIL PROTECTED]>
wrote:
>The snippet of code below gives the result which follows
>
>for k in ut.keys():
> name= k.split('_')
> print '\n1', name
> if len(name) > 1:
> name[0]= name[0] + name[1].capitalize()
> print '2', nam
Repton wrote:
> I often find myself storing data in a list of tuples, and I want to ask
> questions like "what is the index of the first tuple whose 3rd element
> is x", or "give me the first tuple whose 2nd element is y".
>
> I know I can do [elem for elem in lst if elem[3] == x][0] or (elem for
Repton wrote:
> I often find myself storing data in a list of tuples, and I want to ask
> questions like "what is the index of the first tuple whose 3rd element
> is x", or "give me the first tuple whose 2nd element is y".
>
> I know I can do [elem for elem in lst if elem[3] == x][0] or (elem for
I often find myself storing data in a list of tuples, and I want to ask
questions like "what is the index of the first tuple whose 3rd element
is x", or "give me the first tuple whose 2nd element is y".
I know I can do [elem for elem in lst if elem[3] == x][0] or (elem for
elem in lst if elem[2] =
Patch / Bug Summary
___
Patches : 349 open ( +1) / 2880 closed ( +1) / 3229 total ( +2)
Bugs: 897 open ( -1) / 5119 closed (+16) / 6016 total (+15)
RFE : 194 open ( +1) / 170 closed ( +0) / 364 total ( +1)
New / Reopened Patches
__
PEP 343 d
Peter Hansen wrote:
> Jorey Bump wrote:
>
>> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>>
>>> it's.
>>
>>
>> +1 for this becoming the official name of Python 3000. ;)
>>
>> And now for something completely different...
>>
>> The larch!
>
>
> Sorry, already taken:
>
> '''Larch - John Guttag
[EMAIL PROTECTED] wrote:
> Python411 is a series of podcasts about Python, aimed at hobbyists and
> others who are learning Python. Each episode focuses on one aspect of
> learning Python, or one kind of Python programming, and points to
> online tools and tutorials. Python related news and events
On Mon, 11 Jul 2005 18:45:20 -0500, Reid Priedhorsky <[EMAIL PROTECTED]> wrote:
>Dear group,
>
>I'd have a class defined in one module, which descends from another class
>defined in a different module. I'd like the superclass to be able to
>access objects defined in the first module (given an inst
Colin J. Williams wrote:
> The snippet of code below gives the result which follows
>
> for k in ut.keys():
>name= k.split('_')
>print '\n1', name
>if len(name) > 1:
> name[0]= name[0] + name[1].capitalize()
> print '2', name
>name[0]= name[0].capitalize()
>print '3',
David Isaac wrote:
> Why don't tuples support an index method?
> It seems natural enough ...
This question has been posed several (many?) times in the past. See the
archives for more detail, but basically the answer that is usually given
is this:
Tuples are intended to be used somewhat like C
Ric Da Force wrote:
> How does setdefault work exactly? I am looking in the docs and can't figure
> it out...
If the key (the first argument) already exists in the dictionary, the
corresponding value is returned. If the key does not exist in the
dictionary, it is stored in the dictionary and b
On Mon, 11 Jul 2005 19:37:03 -0400,
Mike Meyer <[EMAIL PROTECTED]> wrote:
> The question is - how far are you really willing to carry this? What
> do you think of allowing arbitrary lvalues, with the assumption that
> the previous arguments are all defined (ala let*)? So you could do:
> class gro
On Mon, 11 Jul 2005 21:18:40 +0530, Dark Cowherd wrote:
> I tend to use exceptions, but I think Joel has a point.
Joel being "Joel On Software" Joel.
> Taking the example code that you have given above.
>
> Let us assume that somebody else is using my_function and DOES NOT
> write a try except
On Mon, 11 Jul 2005 13:47:22 -0700, [EMAIL PROTECTED] wrote:
> I am using this function to parse data I have stored in an array.
>
> This is what the array looks like:
>
> [['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
> 'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ... ]
Python411 is a series of podcasts about Python, aimed at hobbyists and
others who are learning Python. Each episode focuses on one aspect of
learning Python, or one kind of Python programming, and points to
online tools and tutorials. Python related news and events will also be
reported upon.
This
The snippet of code below gives the result which follows
for k in ut.keys():
name= k.split('_')
print '\n1', name
if len(name) > 1:
name[0]= name[0] + name[1].capitalize()
print '2', name
name[0]= name[0].capitalize()
print '3', name
1 ['logical', 'or']
2 ['logicalOr', 'o
How does setdefault work exactly? I am looking in the docs and can't figure
it out...
Ric
"Ric Da Force" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thank you guys! (Reinhold, Mark and Markus) I must confess that I am
> absolutely awe struck at the power of this language! Th
HTMLgen looks like it might fit the bill.
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> I should have been more specific. The report needs to be presentable to
> my users and needs to have rich text type properties (multiple colors,
> tables, etc) Therefore, I would like to use ht
On Tue, 12 Jul 2005 10:12:33 +1000, John Machin <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> E.g., so we could write
>>
>> for x in seq if x is not None:
>
>Chundrous; looks like that p**l language ...
^--piqued my interest, where'd that come from? ;-)
>
>> print repr
I should have been more specific. The report needs to be presentable to
my users and needs to have rich text type properties (multiple colors,
tables, etc) Therefore, I would like to use html if possible.
I didn't know if there was already a report writing type of utility
already built using py
Jules Dubois wrote:
> On Monday 11 July 2005 15:23, David Isaac <[EMAIL PROTECTED]>
> (<[EMAIL PROTECTED]>) wrote:
>
>>Why don't tuples support an index method?
>
> 19:27:32:~ $ python
> Python 2.3.5 (#2, Jun 19 2005, 13:28:00)
> [GCC 3.3.6 (Debian 1:3.3.6-6)] on linux2
> Type "help", "co
On Monday 11 July 2005 15:23, David Isaac <[EMAIL PROTECTED]>
(<[EMAIL PROTECTED]>) wrote:
> Why don't tuples support an index method?
19:27:32:~ $ python
Python 2.3.5 (#2, Jun 19 2005, 13:28:00)
[GCC 3.3.6 (Debian 1:3.3.6-6)] on linux2
Type "help", "copyright", "credits" or "license" for
"edgrsprj" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> PROPOSED EARTHQUAKE FORECASTING
> COMPUTER PROGRAM DEVELOPMENT EFFORT
> Posted July 11, 2005
The first posting in this series should have provided computer
programming groups around the world with a good understanding
Bengt Richter wrote:
> E.g., so we could write
>
> for x in seq if x is not None:
> print repr(x), "isn't None ;-)"
>
> instead of
>
> for x in (x for x in seq if x is not None):
> print repr(x), "isn't None ;-)"
>
> just a thought.
>
> Regards,
> Bengt Richter
Is it n
I am writing a Python script that uses the win32all winsound package to
play a .wav file. I the sound come out of the left hand speaker, but
not the right hand speaker.
I've look at some Python sound libraries (PySonic, Audiere, pygame), as
well as any number of command line .wav file players. For
It really does depend. For instance, some other programmers where I
work came up with a way to represent a hierarchical, somewhat random
data set by creating each object and then adding attributes to those
for each subobject, and so on down the tree. However, you could never
really be sure that t
geon schrieb:
> Hi,
>
> When I try to upload many files I get such a error message:
>
> [...] traceback deleted
>
> ftputil.ftp_error.TemporaryError: 421 Login Timeout (25 seconds): closing
> contro
> l connection.
>
> I think its not about many files but because of it takes too long for my ft
[Tim Peters]
>> All Python behavior in the presence of infinities, NaNs, and signed
>> zeroes is a platform-dependent accident, mostly inherited from that
>> all C89 behavior in the presence of infinities, NaNs, and signed
>> zeroes is a platform-dependent crapshoot.
[Michael Hudso
Thank you guys! (Reinhold, Mark and Markus) I must confess that I am
absolutely awe struck at the power of this language! There is no way in the
world that I would have envisaged such simple and elegant solutions!!!
Reinhold, is your solution specific to 2.4?
Kind Regards,
Ric
"Reinhold Bir
"Reid Priedhorsky" <[EMAIL PROTECTED]> wrote:
> Dear group,
>
> I'd have a class defined in one module, which descends from another class
> defined in a different module. I'd like the superclass to be able to
> access objects defined in the first module (given an instance of the first
> class) wit
Bengt Richter wrote:
> E.g., so we could write
>
> for x in seq if x is not None:
Chundrous; looks like that p**l language ...
> print repr(x), "isn't None ;-)"
>
> instead of
>
> for x in (x for x in seq if x is not None):
Byzantine ...
> print repr(x), "isn't None ;
This is perfect. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
E.g., so we could write
for x in seq if x is not None:
print repr(x), "isn't None ;-)"
instead of
for x in (x for x in seq if x is not None):
print repr(x), "isn't None ;-)"
just a thought.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
Dear group,
I'd have a class defined in one module, which descends from another class
defined in a different module. I'd like the superclass to be able to
access objects defined in the first module (given an instance of the first
class) without importing it. Example of what I'm looking for:
<<>>
"Ralf W. Grosse-Kunstleve" <[EMAIL PROTECTED]> writes:
> --- Bengt Richter <[EMAIL PROTECTED]> wrote:
>> No, that limitation wouldn't exist, so you wouldn't have to explain it ;-)
>> I.e., the above would act like
>>
>> class Foo:
>> x = Bar()
>> def method_1(self, _anonymous_arg_1):
>
--- Rob Williscroft <[EMAIL PROTECTED]> wrote:
> class MyClass(object):
> @init_self
> def __init__( self, x, _y, z ):
> print "in __init__() _y =", _y
Here are the timings (script attached):
overhead: 0.01
plain_grouping: 0.26
update_grouping: 0.45
plain_adopt_grouping: 0.69
au
vch wrote:
> Here's an example from some book:
>
> def foo(n):
> s = [n]
> def bar(i):
> s[0] += i
> return s[0]
> return bar
>
> what I don't understand is how this example works, taking into account
> the LGB rule. I thought that s is not accessible from bar, but
--- Rob Williscroft <[EMAIL PROTECTED]> wrote:
> def init_self( init ):
> class KeywordArgumentError(Exception):
> pass
>
> vn = init.func_code.co_varnames[ 1 : init.func_code.co_argcount ]
>
> def decorated_init(self, *args, **kw):
> off = 0
> for name in vn:
> if n
vch wrote:
> Here's an example from some book:
>
> def foo(n):
> s = [n]
> def bar(i):
> s[0] += i
> return s[0]
> return bar
>
> what I don't understand is how this example works, taking into account
> the LGB rule. I thought that s is not accessibl
Ralf W. Grosse-Kunstleve wrote in
news:[EMAIL PROTECTED] in
comp.lang.python:
> Does anyone know if there is a way to hide the _ or self_ from the
> user of the class, i.e. given:
>
> class foo(object):
> @attribute_decorator
> def __init__(self, x, _y, z):
> pass
>
> c
The correct answer to the above question
How long is a piece of string?
is
2 times half it's length
CEC
--
http://mail.python.org/mailman/listinfo/python-list
Tommy Nordgren wrote:
> In order to correctly compile and link my Application, I need a OS
> independent way to find compiler options and linker options necessary to
> find header files and libraries. What methods should I use from
> DistUtils for this purpose.
I don't think distutils supports
Hugh Macdonald wrote:
> The problem in this workflow is taking the C python function that I've
> defined (using the standard "static PyObject *someFunction(PyObject
> *self, PyObject *args)" method) and converting this into a Py_Object.
> Any ideas?
You should use PyCFunction_New(Ex), passing a st
Here's an example from some book:
def foo(n):
s = [n]
def bar(i):
s[0] += i
return s[0]
return bar
what I don't understand is how this example works, taking into account
the LGB rule. I thought that s is not accessible from bar, but it is,
Terry Hancock wrote:
> /* Comment right before the gettext call, obviously in C */
> printf(_("Apparently ambiguous string to translate"));
>
> This will get captured into the .po file, according to the
> gettext manual and appear as a comment right before
> the msgid (i.e. next to the line number
On 2005-07-11, ChrisH <[EMAIL PROTECTED]> wrote:
> I have some data in the following format:
>
> Fred Flintstone,445553454,47634565
> Wilma Flintstone,74857346,27576847
> Barney Rubble,73487346,27576435
>
> I need to convert this data into a report with the user's name and
> difference between the
I'd like to proffer the suggestion we meet for dinner at 6pm at Mei
Long in Mountain View, although it's probably best to run it past our
dinner coordinator first to make sure it gets his OK. What say you
Brian ?
On 7/11/05, Aahz <[EMAIL PROTECTED]> wrote:
>
>
> Before the meeting, we may meet
I have some data in the following format:
Fred Flintstone,445553454,47634565
Wilma Flintstone,74857346,27576847
Barney Rubble,73487346,27576435
I need to convert this data into a report with the user's name and
difference between the 2 numbers.
Can someone recommend a good way to do this?
BTW,
--- Lonnie Princehouse <[EMAIL PROTECTED]> wrote:
> IIRC, the self.__dict__.update(locals()) trick confuses psyco.
>
> But you can make a decorator to achieve the same result. There's not
> really a convincing case for extending python syntax.
Not if you have (enough memory for) psyco. :)
I am
[EMAIL PROTECTED] wrote:
> Sorry for posting twice.
>
Sorry for forgetting my .
Reinhold
--
http://mail.python.org/mailman/listinfo/python-list
use os.path.walk() or os.walk()
Tuxlover
--
http://mail.python.org/mailman/listinfo/python-list
Sorry for posting twice.
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-07-11, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I'm a beginner, and what I want to accomplish is this:
>
> 1. For all files under several folders, do some processing (using an
> existing program). The program will output one line of text for each
> file.
>
> 2. Store the output of a
Hi,
I'm a beginner, and what I want to accomplish is this:
1. For all files under several folders, do some processing (using an
existing program). The program will output one line of text for each
file.
2. Store the output of all files in one file.
It would be great if someone can give me a cr
IIRC, the self.__dict__.update(locals()) trick confuses psyco.
But you can make a decorator to achieve the same result. There's not
really a convincing case for extending python syntax.
def attribute_decorator(f):
import inspect
argnames = inspect.getargspec(f)[0]
def decorator(*arg
[EMAIL PROTECTED] wrote:
> Is it possible to set an environment variable from inside the python
> script which will be retained after the script exits.
>
> If I use the following code:
>
> import os
> os.putvar("name", "tuxlover")
>
> the enivironment variable name is visible to only the sub-pro
Why don't tuples support an index method?
It seems natural enough ...
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
Ralf W. Grosse-Kunstleve wrote in
news:[EMAIL PROTECTED] in
comp.lang.python:
> --- Robert Williscroft <[EMAIL PROTECTED]> wrote:
>
>> My apologies for having to resort to email but for some reason I
>> can't post this message to comp.lang.python. I've tried about 4 times
>> including starting a
"edgrsprj" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> PROPOSED EARTHQUAKE FORECASTING
> COMPUTER PROGRAM DEVELOPMENT EFFORT
> it jumps strait to the display routine and uses the entered command to
begin
Should be the word "straight" instead of strait.
--
http://mail.python.o
Your code is needlessly complicated.
Instead of this business
while 1:
try:
i = fetch.next()
except stopIteration:
break
simply write:
for i in fetch:
(if there's an explicit 'fetch = iter(somethingelse)' in code you did
not show, then get rid of tha
Is it possible to set an environment variable from inside the python
script which will be retained after the script exits.
If I use the following code:
import os
os.putvar("name", "tuxlover")
the enivironment variable name is visible to only the sub-process
created by os.system and os.popen. But
I want to write an application that embeds and extends (at least) the
Python and Perl interpreters. Now i want to find as much as possible
about the Python tools used for extending and embedding Python.
To be more specific: My app should:
1. Parse an input file.
2. Call a script in some scripting
Vivek Chaudhary enlightened us with:
> Is it possible to set an environment variable in python script whose
> value is retained even after the script exits.
It is, if you have absolute control over the calling environment.
> Is it possible to somehow create this environment variable inside
> pyth
The next meeting of BayPIGgies will be Thurs, July 14 at 7:30pm at
Google, building 40, room Temp Tech Talk.
Alex Martelli will be doing his "Black Magic" talk on descriptors,
decorators, and metaclasses. Prepare to have your head exploded!
BayPIGgies meetings alternate between IronPort (San Br
I am using this function to parse data I have stored in an array.
This is what the array looks like:
[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0',
'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory',
François Pinard <[EMAIL PROTECTED]> wrote:
>> > Mascyma is (trying to be) a user-friendly graphical frontend for
>> > the Computer Algebra System GNU MAXIMA.
>
>> I was not successful googling for this one. Would you have an URL handy?
>
> Oops, OK! Found it at http://cens.ioc.ee/~pearu/misc/m
On 2005-07-11, Vivek Chaudhary <[EMAIL PROTECTED]> wrote:
> Is it possible to set an environment variable in python script whose
> value is retained even after the script exits.
No, not in Unix/Linux. In VMS I think there is.
--
Grant Edwards grante Yow! I thin
Is it possible to set an environment variable in python script whose
value is retained even after the script exits.
Doing the following creates an environment variable "name" which is
visible to only subprocesses created by os.system() and os.popen().
os.putvar("name", "vivek")
Is it possible t
--- Robert Williscroft <[EMAIL PROTECTED]> wrote:
> My apologies for having to resort to email but for some reason I can't post
> this message to comp.lang.python. I've tried about 4 times including
> starting a
> new thread, but for some reason it doesn't turn up, though I've followed
> up on
>
enas khalil wrote:
>
> when i write a code to import some module like the following :
>
>
> from nltk.probability import ConditionalFreqDist
>
> I got the error :
>
> Traceback (most recent call last):
> File "C:\Python24\toky.py", line 1, in -toplevel
--- Bengt Richter <[EMAIL PROTECTED]> wrote:
> >I still think it's too specialized. What would, hypothetically, this do?
> >
> >class Bar: pass
> >
> >class Foo:
> >x = Bar()
> >def method_1(self, x.y):
> >pass
> >
> >It's hard to explain that you can autoassign self.y but not x.y.
On Monday 11 July 2005 09:19 am, peter wrote:
> I've read all the posts concerning relative imports of modules and I am
> glad I saw some consensus on a syntax.
> At this moment I am however bound to python 2.3.
>
> Does anyone know a good workaround (or a library) which can achieve a
> relative i
Hi,
On Mon, 11 Jul 2005 15:29:41 +0200, Mage wrote:
> Dear All,
>
> I am writing a database import script in python and I would like to
> print the percentage of the process to the last line. I would like to
> update the last line at every percent. You know what I mean.
>
> How can the
Mark Jackson wrote:
> "Ric Da Force" <[EMAIL PROTECTED]> writes:
>
>> It is hard to explain but this is what I mean:
>>
>> Dict = {'rt': 'This is repeated', 'sr': 'This is repeated', 'gf': 'This is
>> not'}
>>
>> I want this to return a new dict with string keys and lists containing the
>> pre
"Ric Da Force" <[EMAIL PROTECTED]> writes:
> It is hard to explain but this is what I mean:
>
> Dict = {'rt': 'This is repeated', 'sr': 'This is repeated', 'gf': 'This is
> not'}
>
> I want this to return a new dict with string keys and lists containing the
> previous keys for repeated values.
Hum... I think an iteritems is better, this way, python don't need to create in memory
a complete list of couple key, value.On 7/11/05, Markus Weihs <[EMAIL PROTECTED]> wrote:
Hi! Dict = {'rt': 'repeated', 'sr':'repeated', 'gf':'not repeated'} NewDic = {} for k,v in Dict.items(): NewDic.setdef
Hi!
Dict = {'rt': 'repeated', 'sr':'repeated', 'gf':'not repeated'}
NewDic = {}
for k,v in Dict.items():
NewDic.setdefault(v, []).append(k)
Regards, mawe
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Try that, it may not be the better solution, but it seems to work:
#def invertDict(d):
# d2 = {}
# for k, v in d.iteritems():
# d2.setdefault(v, []).append(k)
# return d2
Cyril
On 7/11/05, Ric Da Force <[EMAIL PROTECTED]> wrote:
Hi all,I have a dictionary containing about
Hi all,
I have a dictionary containing about 300 items, some of the values being
repeated. Both keys and values are strings. How can I turn this thing on
its head so that we create a key based on each unique value and build the
values based on the keys corresponding to the repeated values?
I
Randy Howard wrote:
> Keith Thompson wrote
> (in article <[EMAIL PROTECTED]>):
>
>
> >\/| |\| __\,,\ /,,/__
> > \||/ | | | jgs (__Y__)
> > /\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
> > ==
Hi,
When I try to upload many files I get such a error message:
Traceback (most recent call last):
File "I:\Python\my_py\wwwzaci\xcopy_ftp.py", line 51, in ?
except: x=host.upload(zdroj, cilFTP,'b')
File "C:\prg\python24\Lib\site-packages\ftputil\ftputil.py", line 463, in uplo
ad
self
Echo wrote:
> What would the best way to get a list of files in a subdirectory in a zip?
>
> The only thing I can come up with is to extract the zip into a temp
> directory and then just grab the list of files in the subdirectory
> that I need. This way seems very messy to me and I was wondering i
I've got a pure python module that parses a certain type of file. It
has a load() function that allows a callback function to be passed for
getting progress information.
In straight python, this works fine.
However, I'm now trying to use this from a C++ program. The current
flow that I'm trying t
Actually, we receive the data in the form of a text file. The original
data is sent from an IBM mainframe then to Ottawa where it is captured
by an "SNA Print Server that receives the VPS print jobs, writes them
to disk and then runs a PERL script program on the disk file. This
PERL script progra
On Mon, 11 Jul 2005 15:37:35 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]>
wrote:
>Dan Sommers wrote:
>
>> Without thinking it all the way through, I suppose these:
>>
>>def method_1(self, *self.l):
>>pass
>>def method_2(self, **self.d):
>>pass
>>
>> could act as if the
Christopher Subich schrieb:
> Kay Schluehr wrote:
> > I think it would be a good idea to pronounce the similarity between
> > function decorators and metaclasses. Metaclasses were once introduced
> > as an arcane art of fuzzy bearded hackers or supersmart 'enterprise
> > architects' that plan at
Jeremy wrote:
> I am (very) new top regular expressions and I am having a difficult time
> understanding how to do them. I have the following in my script:
>
> zaidsearch = r'''^ {5,}([\d]{4,5})(.\d{2,2}c)'''
> ZAIDSearch = re.compile(search, re.IGNORECASE)
>
> When I do: ZAID.search(...) then
1 - 100 of 146 matches
Mail list logo