Hallo,
I need to search list a for the sequence of list b
First I went
>>> a=[1,2,34,4,5,6]
>>> b=[2,3,4]
>>> a in b
False
So
''.join([ v.__str__() for v in b ]) in ''.join([ v.__str__() for v in a ])
>>> s=SomeObject()
>>> a=[1,2,3,[s,3,[4,s,9]],s,4]
>>> b=[3,[s,3,[4,s,9]],s,4]
>>> ''.join([
> > val = BETTER foo THAN bar
> >
> > ;-)
> >
> > Cobol-strikes-back-ly yours,
> >
> > George
>
> I use a ETL language/tool that actually has a function for this kind
> of thing:
>
> NulltoValue(value,defaultValue)
>
> it returns defaultValue if value is null otherwise value.
even Ksh has one
> On Feb 7, 12:20 pm, "Sébastien Vincent" free.fr>
> wrote:
> > I've found some class on the Net which takes basically this form :
> >
> > ##
> > class Foo:
> > def __init__(self):
> > self.tasks = []
> >...
> >
> > def method1(self):
> > tasks = []
> > w
Hallo,
I'm after
[[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]]]
(NxN 'grid', 5x5 in that example, and while typing this up i figured out
how to get it, but I'm still not sure what _was_ happening)
I'm trying
a=[]
>>> row=[ [] for n in range(0,10) ]
> On Wed, 06 Feb 2008 17:32:53 -0600, Robert Kern wrote:
>
> > Jeff Schwab wrote:
> ...
> >> If the strings happen to be the same length, the Levenshtein distance
> >> is equivalent to the Hamming distance.
Is this really what the OP was asking for. If I understand it correctly,
Levenshtein
"Mark" <[EMAIL PROTECTED]> wrote
> > Is it possible to traverse say python lists via http://
>
> http is a network protocol.
> What does that have to do with traversing python lists?
> Can you clarify what you mean by that?
>
> > say there is a list in the memory
> > can we traverse the lis
> I try not to top-post in this group, but the strange formatting of the
> message makes this advisable, as I am sure many people won't even
> persist in reading down as far as the "content".
>
> Can I make a wild-assed guess that you are a Lotus Notes user reading
> python-list? Please try an
|--->
| Internet |
| [EMAIL PROTECTED]|
| |
|
Internet
[EMAIL PROTECTED]
Ok, probably not the answer your after.
csound can do this easily.
If you doing it via python, you'll need some way of FFT analysing sample
data and analysing that to get which frequencies have the most energy...
although I'm sure there are some, I don't know the names of any python libs
that do
As other have said, it's because exec_command uses a new session each time.
You may get some joy with this, untested
exec_command('cd /some/where; somecommand')
uses the semi-colon to separate multiple commands on one command line.
Matt.
> Another interesting technique, similar to GA, is SA or Simulated
> Annealing. You should be able to adapt your quickga.py program to an
> SA approach without too much trouble, and comparing the two should
> tickle your academic bemusement.
I shall take a look.
This message and any at
On Feb 1, 9:11 am, [EMAIL PROTECTED] wrote:
>
> > 0. Tack this bit onto the end of quickga.py, and you wont have to
> > write a separate routine to import quickga and invoke evolve():
> >
> > > if __name__ == "__main__":
> > > evolve()
> >
> > I hear you, but something I dont ten
On Jan 31, 10:43 am, [EMAIL PROTECTED] wrote:
> > Hi,
> >
> > I got some help with this from here, and there's been a little bit of
> > discussion around GA's recently, so thought I'd post up my likey slow
and
> > clunky version of a GA that in essence just 'evolves' a solution to
'make a
>
> S
>> What is the best way to in python to identify the list items that
>> overlap and the items that don't overlap with any other.
>>
>Is this usable?
>Assuming you transform your 3 tuples into a list of start-end 2 tuples and
sort them for lowest to highest, then
>lst=[(55,58,52),(20,22,18
Internet
looking into speeding up the GA code I posted, I ran it with cProfile.
Fri Feb 01 11:05:57 2008evprof
30100116 function calls in 93.614 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
7160929 34.5420.000 37
Usually. I this case though, I really wasnt planning ahead too much as I
wrote it and thats the way it happened... not the best of excuses I know.
I've been thinking about the consequences though, and I'd have to run it to
see really, but I'm thinking looking for average population fitness should
> Heres the code
>
> def increment(digits,symbols):
> overflow=True
> digitpos=-1
> while overflow and -digitpos<=len(digits):
> digitsymbolindex=symbols.index(digits[digitpos])
> if digitsymbolindex==len(symbols)-1:
>
Hmm, how does this fare??
for i in range(len(a)):
if a[i]==99: a=a[:i]+a[i+1:]
I like following your guys code noodling. I can come up with something
that does what it appears your doing, sometimes, but as to it's relevant
merits I havent a clue :)
matt.
Hi,
I got some help with this from here, and there's been a little bit of
discussion around GA's recently, so thought I'd post up my likey slow and
clunky version of a GA that in essence just 'evolves' a solution to 'make a
sum that evaluates to n using */+-0123456789' it's a really simple GA tha
Not a python solution, but if you look into how this was achieved with Java
it may give hints to the technique needed in python;
robocode, lets you specify your robot AI as java code. You design the AI,
download a bunch of AI's written by other people and the robocode engine
simulates a battle be
It was a very loosely thought out problem, and my Maths isn't good enough
to define 'sane' rules for collapsing the signs/operators to make a
sensible expression; so take my constraints with a pinch of salt.
I guess a better way of putting it may be - now it has been pointed out
that 8+++9 i
On Mon, 28 Jan 2008 15:10:54 +, Matthew_WARREN wrote:
> Hi pythoners.
>
> I am generating strings of length n, randomly from the symbols
>
> +-/*0123456789
>
> What would be the 'sensible' way of transforming the string, for example
> chan
Hi pythoners.
I am generating strings of length n, randomly from the symbols
+-/*0123456789
What would be the 'sensible' way of transforming the string, for example
changing '3++8' into 3+8
or '3++--*-9' into '3+-9' such that eval(string) will always return a
number?
in cases where multipl
had to say, that subject conjoured up an interesting image in my head :)
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord w
You should read this page, it will help you solve your problem:
http://catb.org/~esr/faqs/smart-questions.html
*nod Steve
Internet
Hallo pyPeople,
I wrote a little snippet of code that takes a list representing some
'digits', and according to a list of symbols, increments the digits through
the symbol list.
so for example,
digits=["a","a","a"]
symbols=["a","b","c"]
increment(digits,symbols) repeatedly would return digits
Matthew_WARREN
I'm just fiddling with this, am no great expert, but I added
def pairs5(x):
o=[]
for n in zip(x[::2],x[1:2]):
o.append(n)
return o
I dont know if that breaks any constraints placed on the problem, but I get
the following output
0.07158942896 0.26600970557
30 matches
Mail list logo