Is it possible to use quotation marks as a variable?
a = input("Insert Here")
If a is " " ":
Do something
Also, would I have to do = or Is ?
If you have double quotes inside a string literal then use single quotes, or escape it.
Don't use is
unless you want to see if two references refer to the same object. To test equality use ==
, a single =
is an assignment:
a = input("Insert Here: ")
if a == '"':
Do something
you have two options:
'"'
"\\""
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.