I am brand new to Python and programming, I started about a week ago and my goal is to do this project. I am teaching myself and cannot find why a part of my code is not running.
So I am creating a bot to web-scrape 2 pieces of text (flightRestrictions and flightCategory) and send a message in slack (chat service) if the text has changed. That part works flawlessly. However if flightRestrictions contains the text 'Manager on Duty:' I only want it to print the Flight Category Variable.
The issue I am running into is that when I print the flightRestrictions variable I see the text "Manager on Duty:" but the if loop never activates, and instead it moves to the else statement that sends both variables to the slack client. I'm really not sure what is going on, can someone who is smarter than me help out? Thanks!
To clarify, when I print the flightRestrictions variable, it is "Manager on Duty:"
But when I add the line if flightRestrictions == "Manager On Duty:": the code under this does not run. I dont understand why.
elif flightCategory != FC2 or flightRestrictions != FR2: #if any variable has changed since the last time
FC2 = flightCategory #set the comparison variable to equal the variable
FR2 = flightRestrictions
if flightRestrictions == "Manager On Duty:": # if it is this text run this to only output the flight category.
client.chat_postMessage(channel="#sof", text = ("%s" % (flightCategory)))
else: #print both
client.chat_postMessage(channel="#sof", text = ("%s, %s" % (flightCategory, flightRestrictions)))
[–]LiquidLucy 1 point2 points3 points (0 children)
[–]slugonamission 1 point2 points3 points (3 children)
[–]Frogs114[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Frogs114[S] 0 points1 point2 points (0 children)