[Python] Python recognise with and without quotation marks

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

  1. Stack

    Stack Membro Participativo

    I have this line of code that works.

    price = df1.loc[:, ['price', 'date']]


    I need to emulate this is as a loop with other metrics like sales and revenue. Is this possible? i.e How do I get Python to reference a word in the list both with and without quotation marks?

    listx = [price,sales, revenue]
    for a in listx:
    a = df1.loc[:, ['a', 'date']]

    Continue reading...

Compartilhe esta Página