I have the following information
A={'g2': [4,5,3], 'g1': [1, 3]}
B=[2,3,5]
Now I want to remeove the elements in B if they are present (as values) in
dictionary A.
My expected solution is
A= {'g2': [4], 'g1': [1] }
I wrote the following piece of code which gives me thhe right code, but I am
s
"ranjan das" wrote
A={'g2': [4,5,3], 'g1': [1, 3]}
B=[2,3,5]
Now I want to remeove the elements in B if they are present (as
values) in
dictionary A.
My first thought was to start with the dictionary, something like
for key in A:
A[key] = [val for val in A[key] if val not in B]
Dunn
ranjan das wrote:
> I have the following information
>
> A={'g2': [4,5,3], 'g1': [1, 3]}
>
> B=[2,3,5]
>
> Now I want to remeove the elements in B if they are present (as values) in
> dictionary A.
>
> My expected solution is
>
> A= {'g2': [4], 'g1': [1] }
>
> I wrote the following piece of
"bob gailer" wrote
On 3/31/2011 1:07 PM, Prasad, Ramit wrote:
This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, .
On Fri, Apr 1, 2011 at 9:52 AM, ranjan das wrote:
> I have the following information
>
> A={'g2': [4,5,3], 'g1': [1, 3]}
>
> B=[2,3,5]
>
> Now I want to remeove the elements in B if they are present (as values) in
> dictionary A.
>
> My expected solution is
>
> A= {'g2': [4], 'g1': [1] }
>
> I wro
ranjan das wrote:
I have the following information
A={'g2': [4,5,3], 'g1': [1, 3]}
B=[2,3,5]
Now I want to remeove the elements in B if they are present (as values) in
dictionary A.
My expected solution is
A= {'g2': [4], 'g1': [1] }
Do you care about the order of the elements in A's value
Steven D'Aprano wrote:
> b = set(B)
> for key, values in A.items():
> A[key] = list( set(values).difference(b) )
>
>
> For Python 3, you will need to change the call A.items() to
> list(A.items()), but otherwise they should be the same.
The documentation doesn't say so explicitly, see
http
>However the sub-modules co.py and order.py are *not* imported by the
>main module. They are only loaded on demand, when you say "import
>stats.co" or "from stats.order import median" or similar.
>So it depends on the module.
That is exactly what I wondering and an excellent example to illustra
I would like to control electronic instruments with PyVISA. I have downloaded
PyVISA and unpacked the files into the Python27/lib/site-packages dir and in
the IDLE
GUI I run "import visa' for a quick check and I get this error:
import visa
Traceback (most recent call last):
File "", line 1,
On 03/30/2011 06:05 PM, Robert Kern wrote:
On 3/30/11 10:32 AM, Neal Becker wrote:
I'm trying to combine 'choices' with a comma-seperated list of
options, so I
could do e.g.,
--cheat=a,b
parser.add_argument ('--cheat', choices=('a','b','c'),
type=lambda x:
x.split(','), default=[])
te
Hi Mark,
On Fri, Apr 1, 2011 at 11:42 AM, wrote:
> I would like to control electronic instruments with PyVISA. I have
> downloaded PyVISA and unpacked the files into the Python27/lib/site-packages
> dir and in the IDLE
> GUI I run "import visa' for a quick check and I get this error:
>
> impo
Hello All,
I would to ask you if somebody has experience or can give direction in a
new project I have.
I have a meta language description (in xml) from which I should generate
code on different
languages. In my case, lisp and tcl.
Any idea in term of design, examples, links will be appreci
Sorry,
On Fri, Apr 1, 2011 at 1:00 PM, Donald Bedsole wrote:
> Hi Mark,
>
> On Fri, Apr 1, 2011 at 11:42 AM, wrote:
>> I would like to control electronic instruments with PyVISA. I have
>> downloaded PyVISA and unpacked the files into the Python27/lib/site-packages
>> dir and in the IDLE
>>
Hello!
I'm going to answer to the question I posted in this list.
After a search trouhg web and analize the code, I just had to add a
try/except statement. Now I get what I need. Here is the information:
directorio = sys.argv[1]
extension = sys.argv[2]
csv_salida = sys.argv[3]
#Here I add the lin
On 01/04/2011 18:00, Donald Bedsole wrote:
Hi Mark,
On Fri, Apr 1, 2011 at 11:42 AM, wrote:
I would like to control electronic instruments with PyVISA. I have downloaded
PyVISA and unpacked the files into the Python27/lib/site-packages dir and in
the IDLE
GUI I run "import visa' for a quic
Hello,
I would like to get advice on the best practice to count elements in a
list (built from scractch).
The number of elements is in the range 1e3 and 1e6.
1) I could create a generator and set a counter (i +=1) in the loop.
2) or simply len(mylist).
I don't need the content of the list,
On Fri, Apr 1, 2011 at 1:09 PM, Karim wrote:
>
> Hello All,
>
> I would to ask you if somebody has experience or can give direction in a
> new project I have.
> I have a meta language description (in xml) from which I should generate
> code on different
> languages. In my case, lisp and tcl.
>
>
"Donald Bedsole" said:
> Sorry,
>
> On Fri, Apr 1, 2011 at 1:00 PM, Donald Bedsole wrote:
>> Hi Mark,
>>
>> On Fri, Apr 1, 2011 at 11:42 AM, wrote:
>>> I would like to control electronic instruments with PyVISA. I have
>>> downloaded PyVISA and unpacked the files into the
>>> Python27/lib
"Donald Bedsole" said:
> Hi Mark,
>
> On Fri, Apr 1, 2011 at 11:42 AM, wrote:
>> I would like to control electronic instruments with PyVISA. I have
>> downloaded PyVISA and unpacked the files into the Python27/lib/site-packages
>> dir
>> and in the IDLE
>> GUI I run "import visa' for a qui
"Donald Bedsole" said:
> Sorry,
>
> On Fri, Apr 1, 2011 at 1:00 PM, Donald Bedsole wrote:
>> Hi Mark,
>>
>> On Fri, Apr 1, 2011 at 11:42 AM, wrote:
>>> I would like to control electronic instruments with PyVISA. I have
>>> downloaded PyVISA and unpacked the files into the
>>> Python27/lib
On 4/1/2011 10:16 AM Karim said...
I would like to get advice on the best practice to count elements
Well, I suspect you're more interested in knowing the total count of how
many as opposed to counting how many. To get the total count of how
many use len(mylist).
Emile
__
Am 01.04.2011 19:16, schrieb Karim:
Hello,
I would like to get advice on the best practice to count elements in a
list (built from scractch).
It's not clear to me what your starting point is.
If you don't have a list and don't need a list, but have a large number
of objects you create in y
The nice thing about Python is you don't have to build things from scratch,
and I imagine most people would discourage on account of it being a waste of
time, other then education value.
But the "best practice" in my humble opinion would be to use the built in
len function. If what you are after i
Am 01.04.2011 19:09, schrieb Karim:
Hello All,
I would to ask you if somebody has experience or can give direction in a
new project I have.
I have a meta language description (in xml) from which I should generate
code on different
languages. In my case, lisp and tcl.
You need to provide more
Am 01.04.2011 19:16, schrieb Karim:
Hello,
I would like to get advice on the best practice to count elements in a
list (built from scractch).
The number of elements is in the range 1e3 and 1e6.
1) I could create a generator and set a counter (i +=1) in the loop.
2) or simply len(mylist).
I
On 04/01/2011 08:29 PM, Knacktus wrote:
Am 01.04.2011 19:09, schrieb Karim:
Hello All,
I would to ask you if somebody has experience or can give direction in a
new project I have.
I have a meta language description (in xml) from which I should generate
code on different
languages. In my case,
Well I tried the setup file and here is what I get:
C:\Users\Rivetmr\PyVisa_1.3\PyVISA-1.3>Python setup.py install
Traceback (most recent call last):
File "setup.py", line 60, in
home_dir = os.environ['HOME']
File "C:\Python27\Lib\os.py", line 423, in __getitem__
return self.d
On 01/04/2011 18:15, Susana Iraiis Delgado Rodriguez wrote:
Hello!
I'm going to answer to the question I posted in this list.
After a search trouhg web and analize the code, I just had to add a
try/except statement. Now I get what I need. Here is the information:
directorio = sys.argv[1]
extens
"Mark R Rivet" wrote
Well I tried the setup file and here is what I get:
C:\Users\Rivetmr\PyVisa_1.3\PyVISA-1.3>Python setup.py install
Traceback (most recent call last):
File "setup.py", line 60, in
home_dir = os.environ['HOME']
Windows doesn't by default define a HOME environment vari
On 01/04/2011 20:10, Alan Gauld wrote:
"Mark R Rivet" wrote
Well I tried the setup file and here is what I get:
C:\Users\Rivetmr\PyVisa_1.3\PyVISA-1.3>Python setup.py install
Traceback (most recent call last):
File "setup.py", line 60, in
home_dir = os.environ['HOME']
Windows doesn't by de
On 04/01/2011 08:41 PM, Knacktus wrote:
Am 01.04.2011 19:16, schrieb Karim:
Hello,
I would like to get advice on the best practice to count elements in a
list (built from scractch).
The number of elements is in the range 1e3 and 1e6.
1) I could create a generator and set a counter (i +=1) in
2011/4/1 Alan Gauld
>
> "Mark R Rivet" wrote
>
>
> Well I tried the setup file and here is what I get:
>> C:\Users\Rivetmr\PyVisa_1.3\PyVISA-1.3>Python setup.py install
>> Traceback (most recent call last):
>> File "setup.py", line 60, in
>> home_dir = os.environ['HOME']
>>
>
> Windows does
Am 01.04.2011 20:56, schrieb Karim:
On 04/01/2011 08:29 PM, Knacktus wrote:
Am 01.04.2011 19:09, schrieb Karim:
Hello All,
I would to ask you if somebody has experience or can give direction in a
new project I have.
I have a meta language description (in xml) from which I should generate
code
Am 01.04.2011 21:31, schrieb Karim:
On 04/01/2011 08:41 PM, Knacktus wrote:
Am 01.04.2011 19:16, schrieb Karim:
Hello,
I would like to get advice on the best practice to count elements in a
list (built from scractch).
The number of elements is in the range 1e3 and 1e6.
1) I could create a g
Hello there,
Totally new to python with some *nix scripting knowledge.
I wrote a simple piece of code as an exercise to an online -free- class that
finds prime numbers. When I run it via IDLE it's taking way more time than if I
run it via a (bash) shell (on Os X 10.6) while doing $>python -d myp
On 04/02/2011 06:38 AM, Knacktus wrote:
Am 01.04.2011 20:56, schrieb Karim:
On 04/01/2011 08:29 PM, Knacktus wrote:
Am 01.04.2011 19:09, schrieb Karim:
Hello All,
I would to ask you if somebody has experience or can give direction
in a
new project I have.
I have a meta language description
On 04/02/2011 07:00 AM, Knacktus wrote:
Am 01.04.2011 21:31, schrieb Karim:
On 04/01/2011 08:41 PM, Knacktus wrote:
Am 01.04.2011 19:16, schrieb Karim:
Hello,
I would like to get advice on the best practice to count elements in a
list (built from scractch).
The number of elements is in the
On 04/02/2011 07:10 AM, Jaime Gago wrote:
Hello there,
Totally new to python with some *nix scripting knowledge.
I wrote a simple piece of code as an exercise to an online -free- class that finds
prime numbers. When I run it via IDLE it's taking way more time than if I run it
via a (bash) shel
On 04/02/2011 07:10 AM, Jaime Gago wrote:
Hello there,
Totally new to python with some *nix scripting knowledge.
I wrote a simple piece of code as an exercise to an online -free- class that finds
prime numbers. When I run it via IDLE it's taking way more time than if I run it
via a (bash) shel
39 matches
Mail list logo