Command line input string type variable vs python string type

I have the following python code:

#!/usr/bin/env python3

import sys


for line in sys.stdin:
    line = line.strip().split(',')
    airline_id = line[1]
    origin = line[3]
    dest = line[8]
    
    print(airline.id)
    print(type(airline.id))
    test = "WN"
    print(type(test))
    print(airline==test)

that out puts:

"WN"
<class 'str'>
<class 'str'>
False

Why does it do this? Why are these two not equal? Is there any difference between python string and command-line string?



Read more here: https://stackoverflow.com/questions/66995971/command-line-input-string-type-variable-vs-python-string-type

Content Attribution

This content was originally published by John Zheng at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: