Python

String

11mia 2020. 7. 28. 01:41
>>> sayHello = 'hello world'
>>> print(sayHello)
hello world

>>> sayHello = "hello world!"
>>> print(sayHello)
hello world!

>>> sayHello = '''
... hello,
... world!
... '''
>>> print(sayHello)

hello,
world!

>>> sayHello = """
... hello,
... world!
... """
>>> print(sayHello)

hello,
world!

>>> sayHello
'\nhello,\nworld!\n'
>>>
>>> hello = 'he said "hello"'
>>> print(hello)
he said "hello"
>>> this = "This is 'A'"
>>> print(this)
This is 'A'
>>> str = 'This is \'A\''
>>> print(str)
This is 'A'

>>> str = "\"Hello World\""
>>> print(str)
"Hello World"
>>>
>>> What = """
... "This is 'A'"
... """
>>> print(What)

"This is 'A'"

>>>