質問

What is the difference between following assignments:

>>> a = 'h'  
>>> a
'h'  
>>> b = "h"
>>> b  
'h'
>>> c = '''h'''
>>> c  
'h'
役に立ちましたか?

解決

There is no difference.

The only difference between ' and " is that you can use one inside the other. E.g.

x = "Hey that's my bike!"
y = 'I responded, "Yes, it is."'

Strings enclosed in ''' and """ can contain both ' or " and can span multiple lines.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top