discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I extract individual values from pmt list and dict


From: Marcus Müller
Subject: Re: How do I extract individual values from pmt list and dict
Date: Wed, 3 Aug 2022 16:27:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

(also, worth noting, that it's a bit annoying that you re-posted your question out of the original thread. Now I have two George-asks-about-PMT threads with identical content. Please don't re-post questions that you've asked not 24hrs ago; that's a bit of a waste of everyone's time.)

On 03.08.22 15:00, Marcus Müller wrote:
Hi George,

first_element = pmt.vector_ref(P_list, 0)

and

spam_element = pmt.dict_ref(P_dict, pmt.to_pmt('spam'), pmt.PMT_NIL)

respectively.

Note that you must not put "payload" data into strings that you put into PMT. `pmt.to_pmt(str)` generates a PMT symbol, and these are saved for evermore in a global table.

Best regards,
Marcus

On 03.08.22 13:19, George Edwards wrote:
Hello GNURadio Community,

Let's assume the following pmt definitions for a list and and dictionary in an 
OOT block:
P_list = pmt.to_pmt([1, 2, 3.45, 'eggs'])
P_dict = pmt.to_pmt({'spam': 20, 'eggs': 40})

How do I explicitly extract the first element in P_list and the value for 'spam' from P_dict?

Thank you!

George

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]