I'm trying to detect if http://
or https://
is in a variable string or not.
For example: http://google.com
or https://google.com
While technically my code works, since it's all one word, it actually bypasses my code thinking that http://
or https://
isn't present in the string.
Is there a way to single out part of the string e.g., find http://
or https://
in a one-word string?
Code is attached - barcode_info
currently contains "http://google.com"
so it should bypass this part since the code is seeing if http:// or https:// is NOT contained in the string.
if "http://" or "https://" not in barcode_info:
print("This QR Code doesn't contain a URL link. Would you still like to view the QR contents? \n")
qr_Opt = input("1. Yes \n 2. No \n")
if qr_Opt == "1":
print("How would you like to view QR contents? \n")
view_Opt = input("1. View in CLI \n2. Output to txt file \n3. View in CLI + txt file\n")
if view_Opt == "1":
print(barcode_info)
quit()
elif view_Opt == "2":
file.write(barcode_info)
quit()
elif view_Opt == "3":
print(barcode_info)
file.write(barcode_info)
quit()
else:
print("Invalid option. Quitting.")
quit()