So I feel rather foolish for this, but I haven't used command line often. I'm using sys.argv to gather arguments from the command line. I'm saving one in particular to a variable called test. It is suppose to be a boolean; however, passing in True or False still renders if(test): to be true. It's something simple i'm sure. Ideas?
poeticinsanity
2
Light Poster
Recommended Answers
Jump to Postsys.argv provides you the string representation of cmd line params. 'True' and 'False' are both strings, and if a string has any content in it at all, the boolean representation is True. You should simply change your condition to
if test.lower() == 'true':
HTH
All 4 Replies
jlm699
320
Veteran Poster
poeticinsanity
2
Light Poster
jlm699
320
Veteran Poster
poeticinsanity
2
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.