What is the output of print('hi'.encode()) in Python?
print('hi'.encode())
Correct answer
D. b'hi'
6 views
D. b'hi'
6 views
str.encode converts text to bytes.
Asked in: Python Interview Standard Library
https://docs.python.org/3/library/index.htmlNot sure why the answer is D? Ask here and get an explanation.