Greetings my masters.
How do I kill a socket which is locked in a recvfrom?
My effort to kill it failed. The socket is running in its own thread. Any
bright ideas?
Med venlig hilsen/Kind regards
Michael B. Arp Sørensen
Programmer / BOFH
"If you want to enter my network while I'm out, you can f
Hello!
I posted this question on the f2py list but since I haven't got any answers
(yet), I thought I'd try my luck here.
I'm having a hard time wrapping a fortran subroutine into a python module. The
problem seems to be related to having a subroutine argument to the fortran
subroutine.
A simpl
Interesting. Can this also be used to make sorting of alphanumerical list items
in a 'numerical' way easier? E.g.:
>>> x
['var_0', 'var_13', 'var_11', 'var_9', 'var_4', 'var_1', 'var_5', 'var_6',
'var_7', 'var_14', 'var_2', 'var_3', 'var_8', 'var_10', 'var_12']
>>> x.sort()
>>> x
['var_0', 'var_1
Albert-Jan Roskam, 13.01.2010 13:51:
Interesting. Can this also be used to make sorting of alphanumerical list items
in a 'numerical' way easier? E.g.:
x
['var_0', 'var_13', 'var_11', 'var_9', 'var_4', 'var_1', 'var_5', 'var_6',
'var_7', 'var_14', 'var_2', 'var_3', 'var_8', 'var_10', 'var_12'
2010/1/13 Albert-Jan Roskam
>
> Interesting. Can this also be used to make sorting of alphanumerical list
> items in a 'numerical' way easier?
> >>> x
> ['var_0', 'var_13', 'var_11', 'var_9', 'var_4', 'var_1', 'var_5', 'var_6',
> 'var_7', 'var_14', 'var_2', 'var_3', 'var_8', 'var_10', 'var_12']
Very concise == neat solutions. Yummy. ;-) Thanks for your replies!
Cheers!!
Albert-Jan
~~
In the face of ambiguity, refuse the temptation to guess.
~~
--- On W
I should note that this doesn't solve the general case of mixed
numeric/alphabetic sorting:
>>> a = ['a_1', 'a_2', 'a_3', 'a_4', 'a_10', 'b_1', 'b_2', 'b_3', 'b_4',
'b_10']
>>> a.sort(key=lambda x: int(x.split('_')[-1]))
>>> a
['a_1', 'b_1', 'a_2', 'b_2', 'a_3', 'b_3', 'a_4', 'b_4', 'a_10', 'b_10'
Hi:
I have a tab-delim file:
col1 col2 col3
andrew1987 1990
jake 1974 1980
jim 1964 1970
lance1984 1992
how can I sort column 2 and get :
jim 1964 1970
jake 1974 1980
lance1984 1992
andrew1987 1990
I know
On Wed, Jan 13, 2010 at 9:21 AM, Hs Hs wrote:
> Hi:
>
> I have a tab-delim file:
>
> col1 col2 col3
> andrew1987 1990
> jake 1974 1980
> jim 1964 1970
> lance1984 1992
>
>
> how can I sort column 2 and get :
> jim 1964 1970
> jake
On Wed, Jan 13, 2010 at 9:21 AM, Hs Hs wrote:
> Hi:
>
> I have a tab-delim file:
>
> col1 col2 col3
> andrew1987 1990
> jake 1974 1980
> jim 1964 1970
> lance1984 1992
>
>
> how can I sort column 2 and get :
> jim 1964 1970
> jake
did use enumerate and was wondering if I could use the line number, or
maybe I could use an re iterator.
Any advice would be much appreciated.
Thanks
paul
__ Information from ESET Smart Security, version of virus signature
database 4767 (20100113) __
The mess
Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def alphanum_key(string):
t = []
for isdigit, group in groupby(string, str.isdigit):
group = ''.join(group)
t.append(int(group) if isdigit else group)
return t
Note
On Wed, Jan 13, 2010 at 8:21 PM, Stefan Behnel wrote:
> Hugo Arts, 13.01.2010 15:25:
>>
>> Here is my solution for the general case:
>>
>> from itertools import groupby
>> def alphanum_key(string):
>> t = []
>> for isdigit, group in groupby(string, str.isdigit):
>> group = ''.join(gro
> I have a tab-delim file:
>
> col1 col2 col3
> andrew 1987 1990
> jake 1974 1980
> jim 1964 1970
> lance 1984 1992
>
> how can I sort column 2 and get :
> jim 1964 1970
> jake 1974 1980
> lance 1984 1992
> andrew 198
> I have a file generated from a webpage.
> I want to search that file for a specific keyword, in my case 'NEW'.
> Once I have found that keyword I want to retrieve information below it, e.g.
> web link, size of file etc.
> When I have this information I move off until I find another 'NEW' and the
Emile
I did use enumerate and was wondering if I could use the line number, or
maybe I could use an re iterator.
Any advice would be much appreciated.
Thanks
paul
__ Information from ESET Smart Security, version of virus signature
database 4767 (20100113) __
On Wed, Jan 13, 2010 at 2:21 PM, Stefan Behnel wrote:
> Hugo Arts, 13.01.2010 15:25:
>>
>> Here is my solution for the general case:
>>
>> from itertools import groupby
>> def alphanum_key(string):
>> t = []
>> for isdigit, group in groupby(string, str.isdigit):
>> group = ''.join(gro
On Wed, Jan 13, 2010 at 6:49 PM, Paul Melvin
wrote:
> Hi,
>
> I have a file generated from a webpage.
>
> I want to search that file for a specific keyword, in my case 'NEW'.
>
> Once I have found that keyword I want to retrieve information below it, e.g.
> web link, size of file etc.
>
> When I h
"Hugo Arts" wrote
the most obvious answer would be to take a look at the 'next()'
function, that should solve this immediate problem.
This would be nmy advice too, but you need to get an explicit iterator to
use it.
it = open(.)
for line in it:
if 'NEW' in line:
ln = it.next
On Thu, Jan 14, 2010 at 12:05 AM, Alan Gauld wrote:
>
> I prefer the next() approach.
Rightfully so. IMO, The while loop with readline is basically the C
version of that, for the poor people who don't have iterators.
> But a third option is to use a split and apply it to the whole file as
> a st
On 01/14/10 06:56, Hugo Arts wrote:
> On Wed, Jan 13, 2010 at 8:21 PM, Stefan Behnel wrote:
>> Hugo Arts, 13.01.2010 15:25:
>>>
>>> Here is my solution for the general case:
>>>
>>> from itertools import groupby
>>> def alphanum_key(string):
>>>t = []
>>>for isdigit, group in groupby(strin
On Thu, Jan 14, 2010 at 1:47 AM, Lie Ryan wrote:
> On 01/14/10 06:56, Hugo Arts wrote:
>> On Wed, Jan 13, 2010 at 8:21 PM, Stefan Behnel wrote:
>>> Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def alphanum_key(string
Hi everybody,
Here is my problem. I have two classes, 'Body' and 'Member', and some
attributes of 'Body' can be of type 'Member', but some may not. The
precise attributes that 'Body' has depend from instance to instance,
and they can be added or deleted. I need any instance of 'Body' to
keep an up
Hi tutor,
I have this code for generating a confidence interval from an array of
values:
import numpy as np
import scipy as sp
def mean_confidence_interval(data, confidence=0.95):
a = 1.0*np.array(data)
n = len(a)
m, se = np.mean(a), sp.stats.stderr(a)
h = se * sp.stats.t._pp
Ok, I got something that seems to work for me. Any comments are welcome.
class Member(object):
def __init__(self):
pass
class Body(object):
def __init__(self):
self.members = []
def __setattr__(self, obj, value):
if isinstance(value, Member):
sel
25 matches
Mail list logo