Re: difference between 2 arrays

2009-08-19 Thread baalu aanand
On Aug 19, 1:48 pm, Pierre  wrote:
> Hello,
>
> I would like to know how to find the difference (set operation)
> between 2 arrays :
>
> a = array([1,2, 3,2,5,2])
> b = array([1,2])
> I want a - b = [3,5]
>
> Well, the equivalence of setdiff in matlab...
>
> I thought a.difference(b) could work, but no : AttributeError:
> 'numpy.ndarray' object has no attribute 'difference'
>
> Thanks !



Hi,

  Here I have given my logic, check whether it helps for you

a = [1,2, 3,2,5,2]
b = [1,2]
j = 0
dif = []
for i in range(len(a)) :
   if a[i] not in b:
 dif.append(a[i])
 j += 1

print dif[k]



Thanks
Baalu
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: difference between 2 arrays

2009-08-19 Thread baalu aanand
On Aug 19, 1:48 pm, Pierre  wrote:
> Hello,
>
> I would like to know how to find the difference (set operation)
> between 2 arrays :
>
> a = array([1,2, 3,2,5,2])
> b = array([1,2])
> I want a - b = [3,5]
>
> Well, the equivalence of setdiff in matlab...
>
> I thought a.difference(b) could work, but no : AttributeError:
> 'numpy.ndarray' object has no attribute 'difference'
>
> Thanks !

Hi,

  Here I have given my logic, check whether it helps for you

a = [1,2, 3,2,5,2]
b = [1,2]
j = 0
dif = []
for i in range(len(a)) :
   if a[i] not in b:
 dif.append(a[i])
 j += 1

print dif

Thanks
Baalu
-- 
http://mail.python.org/mailman/listinfo/python-list


difference between raw_input() and input()

2009-08-20 Thread baalu aanand
Hi,

 I have used both raw_input() and input() for a same input value.
But these gives different output.

 I have listed below what actually I have done

>>> a = raw_input("===>")
   ===> 023
>>> a
'023'

 I have given the same value for the input() but it gives 19 as
result
>>> a = input("===>")
   ===>  023
>>> a
19

  Is there anything hide within this. Please illustrate the difference
between raw_input() and input()

Thanks in advance
Baalu
-- 
http://mail.python.org/mailman/listinfo/python-list