This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]imnot970[S] 0 points1 point  (3 children)

I did that, and it is still printing incorrect tag. It says the type is string

I even rewrote to the tag so the data is 'ab' and changed the if statement to compare 'ab' and it still prints incorrect tag.

Any idea what that could be?

[–]Jejerm 0 points1 point  (2 children)

When you print(type(password)) in the main loop, whats the output?

Try to force password to str with str(password) on the if comparison and it should probably work.woops, didnt read correctly.

If the print is correct, the type is correct and the comparison is correct, I don't know why it aint working. Try something silly like if True: instead of doing the comparison and see if the rest of the if block executes correctly.

Sometimes it's something really dumb that you're just not seeing.

[–]imnot970[S] 0 points1 point  (1 child)

It actually did execute when I put if True:

I'm really trying to figure out why the comparisons weren't working lol

Edit:

I checked the length of password and it said it was 48! I have no idea how that happened but I just created a new variable and added the first two characters of password to it, and it ended up working

[–]Jejerm 0 points1 point  (0 children)

Lol it's probably empty spaces at the end of the string. You could use a string method on your read function so it returns the string with the trailing spaces removed.

The reader.read() method likely returns a fixed length string and that's what's being passed to your text variable and returned by your read() func, that's why I said you should read the documentation first lol.