Is it possible to create an error in the input class, or what is the difference between str and input?

If I try to place the following value : "' as text when by putting it in brackets as follows: a = str(""'"), it will give the following error:

SyntaxError: EOL while scanning string literal

On the other hand if I enter "' as an input it will accept it by default as a string.

How does the input class manage to convert it to string?

And is there any sequence of keys that will cause the input class to get an error when receiving a value and converts it to string?

>Solution :

When you want both quote marks: " and ' inside a literal string, you can either add them separately or you can use so-called triple-quotes to surround them:

a = '''""' '''  # note the trailing space
b = """ ""'"""  # note the leading space
print(a)
print(b)

This may not be what you want.

Alternatively:

double = '"'
single = "'"
a = double + single
print(a)

Leave a Reply