[Python] Comparing string for equality with == operator in python [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to compare two string variables with == and it is not working for some reason. For example this code

    print(dictionary[0])
    print("A")
    print(dictionary[0] == "A")


    prints out

    A
    A
    False


    I don't understand why it returns False when they are clearly equal.

    Continue reading...

Compartilhe esta Página