On Sep 22, 1:30 am, Peter Otten <__pete...@web.de> wrote:
>
> array([1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3])
>
> Peter
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Given
m=numpy.array([[1, 2, 3]])
I want to obtain
array([[1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]])
One way I've found to do this is:
numpy.reshape(numpy.tile(m,(4,1)),(12,1),'f').T
Another way is:
numpy.reshape(numpy.tile(m,(4,1)).flatten(1),(1,12))
Is there a simpler way to do this, without h
Is there a built-in method in python that lets you specify a "default"
value that will be returned whenever you try to access a list item
that is out of bounds? Basically, it would be a function like this:
def item(x,index,default):
try:
return x[index]
except IndexError:
return
If I do this:
import re
a=re.search(r'hello.*?money', 'hello how are you hello funny money')
I would expect a.group(0) to be "hello funny money", since .*? is a
non-greedy match. But instead, I get the whole sentence, "hello how
are you hello funny money".
Is this expected behavior? How can I s
I'm trying to write a very simple HTTP client/server program where the
client uploads a file via PUT using pycurl, and the server accepts the
file, "POpen"s a program, sends back "HELLO" to the client, then
displays "good morning".
The problem is when the "POpen"ed C++ program (test1.cpp below) wa