Is there a way to transform Currency to float ? built-in reverse cu() function ?

107 views
Skip to first unread message

Ismaël Benslimane

unread,
Jun 24, 2021, 8:48:02 AM6/24/21
to oTree help & discussion
Hi,
I need to get the participation_fee in a float format (python side), now I do like this :
float(str(player.session.config['participation_fee']).replace(" €","").replace(",","."))
It's ok but I wonder if there is a simple way or a built-in function like cu() but reverse?
Thanks,
Ismaël

Chris @ oTree

unread,
Jun 24, 2021, 8:52:43 AM6/24/21
to Ismaël Benslimane, oTree help & discussion
Just float()

Sent from my phone

On Jun 24, 2021, at 6:48 AM, Ismaël Benslimane <ismae...@gmail.com> wrote:

Hi,
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/62c9d009-17c2-445f-b38e-a73f2a41ba1en%40googlegroups.com.

Ismaël Benslimane

unread,
Jun 24, 2021, 8:59:46 AM6/24/21
to oTree help & discussion
Lol the easiest answer in the world, Thanks Chris, I don't know why when I tried it, it didn't work, probably an error somewhere else.
Reply all
Reply to author
Forward
0 new messages