[Python] Dynamically script conditional statements in Python

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    I have a fixed table with (name,value) pairs that are known. I.e.:

    Bob.age: 47
    Bill.age: 44
    Jane.age: 36
    Steve.age: 22


    I'd like a user to be able to write in a json file, a statement to dynamically generate a conditional statement to evaluate to true/false for a report:

    (Bob.age == Jane.age) || (Bob.age < Bill.age)


    I can do this manually via regex but I was wondering if there was already a tried and tested library for this kind of thing.

    Continue reading...

Compartilhe esta Página