это то же самое:..? Обратитесь к документации Python для получения дополнительной информации: https://docs.python.org/3/tutorial/introduction.html
3.1.2. Strings
Besides numbers, Python can also manipulate strings,
which can be expressed in several ways.
They can be enclosed in single quotes ('...') or double quotes ("...")
with the same result [2]. \ can be used to escape quotes:
Функция печати опускает цитату:
In the interactive interpreter, the output string is enclosed in quotes and special characters are escaped with backslashes.
While this might sometimes look different from the input (the enclosing quotes could change), the two strings are equivalent.
The string is enclosed in double quotes if the string contains a single quote and no double quotes, otherwise it is enclosed in single quotes.
The print() function produces a more readable output, by omitting the enclosing quotes and by printing escaped and special characters
>>> '"Isn\'t," she said.'
'"Isn\'t," she said.'
>>> print('"Isn\'t," she said.')
"Isn't," she said.
>>> s = 'First line.\nSecond line.' # \n means newline
>>> s # without print(), \n is included in the output
'First line.\nSecond line.'
>>> print(s) # with print(), \n produces a new line
First line.
Second line.
Нет никакой разницы. Лучшее - это то, что вы предпочитаете, поэтому оно полностью зависит от личных предпочтений. –
Обычно я предпочитаю одинарные кавычки, потому что он включает в себя еще одно нажатие клавиши, потому что вам не нужен клавиша shift. – Erotemic