In Python if you return a string,it will be displayed with quotes around it but If you print the string, it will not be shown with quotes. why? [duplicate]
问题 This question already has answers here : In Python interpreter, return without “ ' ” (2 answers) Closed last year . In the Python interactive prompt, if you return a string, it will be displayed with quotes around it. But if you just print the string, it will not be shown with quotes. Why? >>> a='world' >>> a 'world' >>> print(a) world 回答1: Simply put: The quotes allow python to treat whatever is inside of them as a 'string literal'; that way, if we wanted to write a string like 'print([0, 1,