On 7 Sep, 07:42, sajuptpm sajup...@gmail.com 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
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,
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,
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:
market code='anlg' tier='ProMarket' mail='True'
title field=prefAnalog Science Fiction and Fact/title
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
Arnaud Delobelle wrote:
Alf P. Steinbach al...@start.no writes:
* Chris Rebert:
On Sun, Feb 7, 2010 at 5:05 PM, T misceveryth...@gmail.com 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,
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)
...
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
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
monte-carlo
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 for
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
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;
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,
alex23 wrote:
Gerard Flanagan grflana...@gmail.com 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
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
Matthias Gallé wrote:
Hi.
My problem is to replace all occurrences of a sublist with a new element.
Example:
Given ['a','c','a','c','c','g','a','c'] I want to replace all
occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]).
For novelty value:
from itertools import izip
def
Steven D'Aprano wrote:
I have a subclass of int where I want all the standard arithmetic
operators to return my subclass, but with no other differences:
class MyInt(int):
def __add__(self, other):
return self.__class__(super(MyInt, self).__add__(other))
# and so on for __mul__,
Walther Neuper wrote:
def reverse_(list):
... list.reverse() returns None; reverse_ returns the reversed
list
... list.reverse()
... return list
...
ll = [[11, 'a'], [33, 'b']]
l = ll[:] # make a copy !
l = map(reverse_, l[:]) # make a copy ?
ll.extend(l)
print(ll=,
odeits wrote:
I am looking to clean up this code... any help is much appreciated.
Note: It works just fine, I just think it could be done cleaner.
The result is a stack of dictionaries. the query returns up to
STACK_SIZE ads for a user. The check which i think is very ugly is
putting another
Michael Rudolf wrote:
Hi, I just wondered how many Packages are in the Python Package Index.
fwiw
http://bitbucket.org/djerdo/musette/src/tip/tools/download-pypi.py
regards
G.
--
http://mail.python.org/mailman/listinfo/python-list
Neal Becker wrote:
I'm looking for something to do template processing. That is, transform
text making various substitutions. I'd like to be able to do substitutions
that include python expressions, to do arithmetic computations within
substitutions.
I know there are lots of template
Astan Chee wrote:
Hi,
I have a list that has a bunch of numbers in it and I want to get the
most common number that appears in the list. This is trivial because i
can do a max on each unique number. What I want to do is to have a
tolerance to say that each number is not quite unique and if
OdarR wrote:
Hi guys,
how would you do a clever find and replace, where the value replacing
the tag
is changing on each occurence ?
...TAGTAGTAG..TAG.
is replaced by this :
...REPL01REPL02REPL03..REPL04...
Gerard Flanagan wrote:
def replace(s, patt, repls):
def onmatch(m):
onmatch.idx += 1
return repls[onmatch.idx]
onmatch.idx = -1
return patt.sub(onmatch, s)
test =
abcTAG TAG asdTAGxyz
REPLS = [
'REPL1',
'REPL2',
'REPL3',
]
print replace(test
Jason wrote:
Hey everyone--
I'm pretty new to Python, I need to do something that's incredibly
simple, but combing my Python Cookbook googling hasn't helped me out
too much yet, and my brain is very, very tired flaccid @ the
moment
I have a list of objects, simply called list. I need
Gabriel Genellina wrote:
En Mon, 02 Feb 2009 12:37:36 -0200, Gerard Flanagan
grflana...@gmail.com escribió:
e = ET.fromstring(s)
def clone(elem):
ret = elem.makeelement(elem.tag, elem.attrib)
ret.text = elem.text
for child in elem:
ret.append(clone(child))
return
m.banaouas wrote:
Hi all,
Working with the ElementTree module, I looked for clone element function but not
found such tool:
def CloneElment(fromElem, destRoot = None)
fromElem is the element to clone
destRoot is the parent element of the new element ; if None so the new element
will be child of
On Jan 23, 2:48 pm, perfr...@gmail.com wrote:
hello,
i am using nested defaultdict from collections and i would like to
write it as a pickle object to a file. when i try:
from collections import defaultdict
x = defaultdict(lambda: defaultdict(list))
and then try to write to a pickle file,
On Thu, 08 Jan 2009 08:42:55 -0600, Rob Williscroft wrote:
def mydecorator( f ):
def decorated(self, *args):
logging.debug( Created %s, self.__class__.__name__ )
for i in f(self, *args):
yield i
return decorated
can optionally be written as:
def mydecorator( f ):
On Dec 28, 5:19 pm, Roger rdcol...@gmail.com wrote:
Hi Everyone,
[...]
When I define a method I always include a return statement out of
habit even if I don't return anything explicitly:
def something():
# do something
return
Is this pythonic or excessive? Is this an
Xah Lee wrote:
On Dec 10, 2:47 pm, John W Kennedy [EMAIL PROTECTED] wrote:
Xah Lee wrote:
In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java,
you'll have 50 or hundreds lines.
[...]
Thanks to various replies.
I've now gather code solutions in ruby, python, C, Java, here:
eric wrote:
Hi,
I've got this two pieces of code that works together, and fine
def testit():
for vals in [[imask==mask for mask in [1j for j in range(6)] ]
for i in range(16)]:
print vals, '-', flag(*vals)
def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False,
DOTALL=False,
r wrote:
To think...that I would preach freedom to the slaves and be lynched
for it...IS MADNESS!
Not one vote for Python, not a care. I think everyone here should look
deep within their self and realize the damage that has been done
today! I hope Guido's eyes never see this thread, for he may
alex23 wrote:
On Nov 28, 4:32 pm, Gerard flanagan [EMAIL PROTECTED] wrote:
http://en.wikipedia.org/wiki/Zero-sum#Complexity
You're a far more generous soul than I am, I would've been more
inclined to link to the following:
http://en.wikipedia.org/wiki/Persecution_complex
Maybe it's just
bullockbefriending bard wrote:
I'm not sure if my terminology is precise enough, but what I want to
do is:
Given an ordered sequence of n items, enumerate all its possible k-
segmentations.
This is *not* the same as enumerating the k set partitions of the n
items because I am only interested
Slaunger wrote:
Hi all,
I am a Python novice, and I have run into a problem in a project I am
working on, which boils down to identifying the patterns in a sequence
of integers, for example
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6
Anton Vredegoor wrote:
On Fri, 21 Nov 2008 18:10:02 +0100
Gerard flanagan [EMAIL PROTECTED] wrote:
data = '''
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3
Slaunger wrote:
Hi Gerard,
This definitely looks like a path to walk along, and I think your code
does the trick, although I have to play a little around with the
groupby method, of which I had no prior knowledge. I think I will
write some unit test cases to stress test you concept (on Monday,
Florian Brucker wrote:
Florian Brucker wrote:
Hi everybody!
Given a dictionary, I want to create a clustered version of it,
collecting keys that have the same value:
d = {'a':1, 'b':2, 'c':1, 'd':1, 'e':2, 'f':3}
cluster(d)
{1:['a', 'c', 'd'], 2:['b', 'e'], 3:['f']}
That is, generate
On Nov 3, 11:45 pm, [EMAIL PROTECTED] wrote:
Thats interesting code but seems to give a different output,
suggesting thet the underlying algorithm is different.
Ignoring linebreaks and case, the original code gives:
abcd bacd bcad bcda acbd cabd cbad cbda acdb cadb cdab cdba abdc badc
bdac
JD wrote:
Hi,
I need help for a task looks very simple:
I got a python list like:
[['a', 'b'], ['c', 'd'], ['e', 'f'], ['a', 'g'], ['e', 'k'], ['c',
'u'], ['b', 'p']]
Each item in the list need to be merged.
For example, 'a', 'b' will be merged, 'c', 'd' will be merged.
Also if the node in
[EMAIL PROTECTED] wrote:
x1 = [] #unique instances of x and y
y1 = [] #median(y) for each unique value of x
for xx,yy in d.iteritems():
x1.append(xx)
l = len(yy)
if l == 1:
y1.append(yy[0])
else:
Gerard flanagan wrote:
[EMAIL PROTECTED] wrote:
x1 = [] #unique instances of x and y
y1 = [] #median(y) for each unique value of x
for xx,yy in d.iteritems():
x1.append(xx)
l = len(yy)
if l == 1:
y1.append(yy[0
George Sakkis wrote:
On Sep 23, 1:23 am, Tom Harris [EMAIL PROTECTED] wrote:
Greetings,
I want to have a class as a container for a bunch of symbolic names
for integers, eg:
class Constants:
FOO = 1
BAR = 2
Except that I would like to attach a docstring text to the constants,
so
Boris Borcic wrote:
Gerard flanagan wrote:
George Sakkis wrote:
..
Note that this works correctly only if the versions are already sorted
by major version.
Yes, I should have mentioned it. Here's a fuller example below.
There's maybe better ways of sorting version numbers
Lee Harr wrote:
I have a class with certain methods from which I want to select
one at random, with weighting.
The way I have done it is this
import random
def weight(value):
def set_weight(method):
method.weight = value
return method
return set_weight
class
Simon Mullis wrote:
Hi,
Let's say I have an arbitrary list of minor software versions of an
imaginary software product:
l = [ 1.1.1.1, 1.2.2.2, 1.2.2.3, 1.3.1.2, 1.3.4.5]
I'd like to create a dict with major_version : count.
(So, in this case:
dict_of_counts = { 1.1 : 1,
George Sakkis wrote:
On Sep 18, 11:43 am, Gerard flanagan [EMAIL PROTECTED] wrote:
Simon Mullis wrote:
Hi,
Let's say I have an arbitrary list of minor software versions of an
imaginary software product:
l = [ 1.1.1.1, 1.2.2.2, 1.2.2.3, 1.3.1.2, 1.3.4.5]
I'd like to create a dict
Ouray Viney wrote:
Hi All:
I am looking at writing a python script that will let me parse a
TestSuite xml file that contains n number of TestCases.
My goal is to be able to count the TestCase elements base on a key
value pair in the xml node.
Example
Testcase execute=true name=foobar
I
George Sakkis wrote:
On Aug 27, 3:00 pm, Gerard flanagan [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
I have a list that starts with zeros, has sporadic data, and then has
good data. I define the point at which the data turns good to be the
first index with a non-zero entry
[EMAIL PROTECTED] wrote:
I have a list that starts with zeros, has sporadic data, and then has
good data. I define the point at which the data turns good to be the
first index with a non-zero entry that is followed by at least 4
consecutive non-zero data items (i.e. a week's worth of non-zero
W. eWatson wrote:
The other night I surveyed a site for astronomical use by measuring the
altitude (0-90 degrees above the horizon) and az (azimuth, 0 degrees
north clockwise around the site to 360 degrees, almost north again) of
obstacles, trees. My purpose was to feed this profile of
On Aug 18, 12:53 am, Gits [EMAIL PROTECTED] wrote:
I want to learn how to program in python and would like to know if you
guys know of any free online tutorials. Or is it too complicated to
learn from a site or books?
Some texts and examples here:
http://thehazeltree.org/
hth
G.
--
[EMAIL PROTECTED] wrote:
Hi,
it's me again with tons of questions. I hava an input file structured
like this:
X XYData-1
1. 3.08333
2. 9.05526
3. 3.13581
Gerard flanagan wrote:
What is it?
---
A Google custom search engine which targets only the following sites:
+ `The Hazel Tree http://thehazeltree.org`__
+ `The Python standard library docs http://docs.python.org/lib`__
+ `The Python wiki http://wiki.python.org`__
+ `Python Package
What is it?
--
A Google custom search engine which targets only the following sites:
+ `The Hazel Tree http://thehazeltree.org`__
+ `The Python standard library docs http://docs.python.org/lib`__
+ `The Python wiki http://wiki.python.org`__
+ `Python Package Index
What is it?
---
A Google custom search engine which targets only the following sites:
+ `The Hazel Tree http://thehazeltree.org`__
+ `The Python standard library docs http://docs.python.org/lib`__
+ `The Python wiki http://wiki.python.org`__
+ `Python Package Index
[EMAIL PROTECTED] wrote:
Hello,
I am new to Python, with a background in scientific computing. I'm
trying to write a script that will take a file with lines like
c afrac=.7 mmom=0 sev=-9.56646 erep=0 etot=-11.020107 emad=-3.597647
3pv=0
extract the values of afrac and etot and plot them. I'm
antar2 wrote:
Hello,
I can not find out how to read a file into a list of lists. I know how
to split a text into a list
sentences = line.split(\n)
following text for example should be considered as a list of lists (3
columns and 3 rows), so that when I make the print statement list[0]
[0],
Jonas Galvez wrote:
Not sure if it's been done before, but still...
from __future__ import with_statement
from xmlbuilder import builder, element
xml = builder(version=1.0, encoding=utf-8)
with xml.feed(xmlns='http://www.w3.org/2005/Atom'):
xml.title('Example Feed')
On Jun 19, 11:19 pm, Calvin Cheng [EMAIL PROTECTED] wrote:
Hi,
I am attempting to convert a bunch of .txt files into html using the
docutils package.
It works for most of the txt files except for the index.txt file which
gives 2 errors:
(1) Error/3 Unknown Directive type toctree
(2)
Maric Michaud wrote:
Le Monday 16 June 2008 20:35:22 George Sakkis, vous avez écrit :
On Jun 16, 1:49 pm, Gerard flanagan [EMAIL PROTECTED] wrote:
[...]
variation of your toy code. I was thinking the Strategy pattern,
different classes have different initialisation strategies? But then you
George Sakkis wrote:
I have a situation where one class can be customized with several
orthogonal options. Currently this is implemented with (multiple)
inheritance but this leads to combinatorial explosion of subclasses as
more orthogonal features are added. Naturally, the decorator pattern
[1]
On May 28, 1:48 pm, afrobeard [EMAIL PROTECTED] wrote:
The following following code fails with the failiure:-
File test.py, line 27, in __main__.sanitize_number
Failed example:
sanitize_number('0321-4683113')
Expected:
'03214683113'
Got:
'03214683113'
Expected and Got looks
Joel Koltner wrote:
Is there an easy way to get a list comprehension to produce a flat list of,
say, [x,2*x] for each input argument?
E.g., I'd like to do something like:
[ [x,2*x] for x in range(4) ]
...and receive
[ 0,0,1,2,2,4,3,6]
...but of course you really get a list of lists:
[[0,
On Apr 29, 3:46 pm, Julien [EMAIL PROTECTED] wrote:
Hi,
I'm fairly new in Python and I haven't used the regular expressions
enough to be able to achieve what I want.
I'd like to select terms in a string, so I can then do a search in my
database.
query = ' some words with and without
On Apr 24, 4:05 am, Paul McGuire [EMAIL PROTECTED] wrote:
On Apr 23, 8:00 pm, Eric Wertman [EMAIL PROTECTED] wrote:
I have a set of files with this kind of content (it's dumped from
WebSphere):
[propertySet [[resourceProperties [[[description This is a required
property. This is an
On Apr 23, 9:17 am, Achillez [EMAIL PROTECTED] wrote:
Hi,
I have a 10k+ line Tcl program that I would like to auto convert over to
Python. Do any scripts exist that can convert ~90% of the standard Tcl
syntax over to Python? I know Python doesn't handle strings, but just for
general syntax
On Apr 19, 11:19 pm, Wilbert Berendsen [EMAIL PROTECTED] wrote:
Hi, is it possible to manipulate class attributes from within a decorator
while the class is being defined?
I want to register methods with some additional values in a class attribute.
But I can't get a decorator to change a
On Apr 11, 12:14 pm, bdsatish [EMAIL PROTECTED] wrote:
The built-in function round( ) will always round up, that is 1.5 is
rounded to 2.0 and 2.5 is rounded to 3.0.
If I want to round to the nearest even, that is
my_round(1.5) = 2# As expected
my_round(2.5) = 2# Not 3, which
On Apr 11, 2:05 pm, Gerard Flanagan [EMAIL PROTECTED] wrote:
On Apr 11, 12:14 pm, bdsatish [EMAIL PROTECTED] wrote:
The built-in function round( ) will always round up, that is 1.5 is
rounded to 2.0 and 2.5 is rounded to 3.0.
If I want to round to the nearest even, that is
my_round(1.5
On Apr 10, 2:11 pm, sven _ [EMAIL PROTECTED] wrote:
Version: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
My goal is to have stdout and stderr written to a logging handler.
This code does not work:
# START
import logging, subprocess
ch = logging.StreamHandler()
On Apr 10, 5:34 pm, Gerard Flanagan [EMAIL PROTECTED] wrote:
On Apr 10, 2:11 pm, sven _ [EMAIL PROTECTED] wrote:
Version: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
My goal is to have stdout and stderr written to a logging handler.
This code does not work
On Apr 3, 8:33 pm, AK [EMAIL PROTECTED] wrote:
AK wrote:
Hello,
I find that I learn easier when I go from specific examples to a more
general explanation of function's utility and I made a reference guide
that will eventually document all functions, classes and methods in
Python's
On Apr 1, 4:03 pm, sophie_newbie [EMAIL PROTECTED] wrote:
Hi, I'm wondering if its possible to copy all of stdout's output to a
string, while still being able to print on screen. I know you can
capture stdout, but I still need the output to appear on the screen
also...
Thanks!
I don't know
On Mar 29, 11:01 am, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
On Sat, 29 Mar 2008 10:11:28 +0100, Roel Schroeven wrote:
Steven D'Aprano schreef:
On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote:
Gabriel Genellina wrote:
That's what I said in another paragraph.
On Mar 25, 1:34 pm, Tzury Bar Yochay [EMAIL PROTECTED] wrote:
Rather than use Foo.bar(), use this syntax to call methods of the
super class:
super(ParentClass, self).method()
Hi Jeff,
here is the nw version which cause an error
class Foo(object):
def __init__(self):
On Mar 25, 4:37 pm, Brian Lane [EMAIL PROTECTED] wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Gerard Flanagan wrote:
Use the child class when calling super:
--
class Foo(object):
def __init__(self):
self.id = 1
def
On Mar 19, 10:29 pm, some one [EMAIL PROTECTED] wrote:
Thanks Diez, I found some docs and examples on urllib2. Now how do i
search the string I get from urllib2, lets say I put it in myURL, How
do I search for only Numbers and .'s in the #.#.#.# pattern. That
is all I am interested in with
On Mar 11, 6:21 am, royG [EMAIL PROTECTED] wrote:
On Mar 10, 8:03 pm, Tim Chase wrote:
In Python2.5 (or 2.4 if you implement the any() function, ripped
from the docs[1]), this could be rewritten to be a little more
flexible...something like this (untested):
that was quite a good lesson
On Mar 10, 4:39 pm, Sam [EMAIL PROTECTED] wrote:
Hello
I would like to implement some kind of comparator, that could be
called as instance method, or static method. Here is a trivial pseudo
code of what I would like to execute
class MyClass:
...def __init__(self, value):
...
On Mar 4, 1:29 pm, Gal Aviel [EMAIL PROTECTED] wrote:
Hello All,
I want to add a logger to my application, then addHandler to it to log to a
special destination.
Unfortunately when I use logging.getLogger(my_logger) to create the new
logger, it apparently comes with a default handler that
On Mar 4, 6:31 am, [EMAIL PROTECTED] wrote:
On Mar 3, 10:01 pm, Benjamin [EMAIL PROTECTED] wrote:
On Mar 3, 7:12 pm, [EMAIL PROTECTED] wrote:
What are metaclasses?
Depends on whether you want to be confused or not. If you do, look at
this old but still head bursting
On Feb 29, 7:55 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
On Thu, 28 Feb 2008 00:54:44 -0800 (PST), [EMAIL PROTECTED] declaimed
the following in comp.lang.python:
On Feb 28, 2:30 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
### I smell Java burning...
+1 QOTW
Mistah Kurtz - he
On Feb 29, 7:56 pm, I V [EMAIL PROTECTED] wrote:
On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote:
return s == s.upper()
A couple of people in this thread have used this to test for an upper
case string. Is there a reason to prefer it to s.isupper() ?
Premature decreptiude, officer...
On Oct 25, 12:20 am, none atavory\@(none) wrote:
Hello,
Is there some package to calculate combinatorical stuff like (n over
k), i.e., n!/(k!(n - k!) ?
I know it can be written in about 3 lines of code, but still...
Thanks,
Ami
On Oct 18, 1:55 am, Debajit Adhikary [EMAIL PROTECTED] wrote:
I'm writing this little Python program which will pull values from a
database and generate some XHTML.
I'm generating a table where I would like the alternate tr's to be
tr class=Even
and
tr class=Odd
What is the best way to
On Oct 17, 3:17 pm, [EMAIL PROTECTED] wrote:
To compute the absolute value of a negative base raised to a
fractional exponent such as:
z = (-3)^4.5
you can compute the real and imaginary parts and then convert to the
polar form to get the correct value:
real_part = ( 3^-4.5 ) * cos( -4.5
On Sep 25, 12:38 am, Dan Stromberg [EMAIL PROTECTED] wrote:
Say I want to take an existing XML document, and change the value=9997
and value=9998 to two different numbers, without changing any of the
rest of the document - not even changing comments or indentation, if
avoidable.
What's the
On Aug 28, 7:55 pm, billiejoex [EMAIL PROTECTED] wrote:
Hi there.
I'm trying to generate a brand new file with a unique name by using
tempfile.mkstemp().
In conjunction I used os.fdopen() to get a wrapper around file
properties (write read methods, and so on...) but 'name' attribute
does
On Aug 21, 12:01 pm, subeen [EMAIL PROTECTED] wrote:
Hi,
I am a newcomer in Python. I am going to write a small Python
application that will run in windows xp. This application needs to
have GUI. Is it possible to make a C# application using visual studio
2005 that will call the python
On Aug 16, 9:48 am, yadin [EMAIL PROTECTED] wrote:
hi every one!
can you please help me to fix these polar plot in db's
so that the center is at the minimun negative number in voltagedb
about [-50]
and the maximun is at zero and how can i see values on the axis like
showing that the axes
On Aug 1, 11:52 pm, Ian Clark [EMAIL PROTECTED] wrote:
Gerard Flanagan wrote:
(snip)
def tostring(data):
return tuple(strftime(x) for x in data[:2]) + data[2:]
Hrmm, not sure that having a function named tostring() that returns a
tuple is the best idea. ;)
oops! SAD (Solipsistic
On Aug 1, 6:11 pm, beginner [EMAIL PROTECTED] wrote:
Hi,
In order to print out the contents of a list, sometimes I have to use
very awkward constructions. For example, I have to convert the
datetime.datetime type to string first, construct a new list, and then
send it to print. The following
On Jul 16, 12:29 pm, [EMAIL PROTECTED] wrote:
hi,
I'm trying to make a local install of python 2.5 on AIX and I'm
getting some trouble with _curses.
Here is how I tried to compile it :
export BASE=/usr/local/python251
cd Python.2.5.1
./configure --prefix=${BASE}/\
On Jul 16, 12:29 pm, [EMAIL PROTECTED] wrote:
hi,
I'm trying to make a local install of python 2.5 on AIX and I'm
getting some trouble with _curses.
Here is how I tried to compile it :
export BASE=/usr/local/python251
cd Python.2.5.1
./configure --prefix=${BASE}/\
On Jul 6, 12:18 am, Christoph Zwerschke [EMAIL PROTECTED] wrote:
Sorry for the soliloquy, but what I am really using is the following so
that the re-raised excpetion has the same type:
def PoliteException(e):
class PoliteException(e.__class__):
def __init__(self, e):
On Jul 4, 1:22 pm, bullockbefriending bard [EMAIL PROTECTED]
wrote:
I was able to google a recipe for a k_permutations generator, such
that i can write:
x = range(1, 4) # (say)
[combi for combi in k_permutations(x, 3)] =
[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 1], [1, 2, 2], [1, 2, 3],
On Jun 13, 11:11 am, Allen [EMAIL PROTECTED] wrote:
a = range(256)
I want to output the formated string to be:
00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
f0 f1 f2
On Jun 13, 11:11 am, Allen [EMAIL PROTECTED] wrote:
a = range(256)
I want to output the formated string to be:
00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
f0 f1 f2
1 - 100 of 333 matches
Mail list logo