Possible Duplicates:
Difference between the use of double quote and quotes in python
Single quotes vs. double quotes in Python
So I am now learning python, and was creating a function. What is the difference between using ‘ and “. I will create a sample function below to exemplify my question.
def question(variable):
print variable
now what is the difference between calling
question("hello")
and
question('hello')
they both print hello, but why can I use both? Is it just because python is flexible? I was confused because ‘ is usually used for chars where as ” is for strings for java right?
Both are equal and what you use is entirely your preference.
As far as the
charvsstringthing is concerned, refer to theZen of Python, (PEP 20 orimport this)A string of length 1 is not special enough to have a dedicated
chartype.Note that you can do: