How are the string type different from one another?
Answers
Answered by
1
There are 2 types of strings supported by python. Strings stored as characters and stored as bytes.
Strings stored as characters are represented as unicode in python 2 or str in python 3. Specifying a unicode string can be done by adding ‘u' before string. Eg u'hello' will be a unicode string.
Strings stored as bytes are represented as str in python 2 or bytes in python 3. Specifying a byte string can be done by adding ‘b' before string. Eg b'hello' will be a byte string.
Similar questions
Hindi,
6 months ago
Math,
6 months ago
Science,
6 months ago
Business Studies,
11 months ago
Physics,
1 year ago
India Languages,
1 year ago