Search code examples
python-3.xdictionaryrepr

python repr function not using quotes when called


this is a code snippet where i called repr on two values that equal, but when compared, they are not equal. So i used repr to debug and the second repr call isnt printing with single quotes. How is that even possible?

        ID = data_match[4]   #current id 
        print(repr(ID))             #'550699433'
        if user in dict:
            for keys,values in online.items():
                print(repr(values)) #550699433
                print(values == ID)  #False

To clarify, I want values == ID to print true and i am using repr for debugging why it is printing false. Also without repr they just both print 550699433.


Solution

  • I'm kidding, do this to see if your values and ID are the same type

    print(type(values))
    print(type(ID))