String length: Difference between revisions

Content added Content deleted
(Undo revision 110843 by 207.10.18.77 (talk))
Line 1,396: Line 1,396:


# The letter Alef
# The letter Alef
>>> len('\u05d0'.encode('utf-8'))
>>>f1 = " abc1234"
2
>>> len( f1)
>>> len('\u05d0'.encode('iso-8859-8'))
1

Example from the problem statement:
<lang python>#!/bin/env python
# -*- coding: UTF-8 -*-
s = "møøse"
assert len(s) == 5
assert len(s.encode('UTF-8')) == 7
assert len(s.encode('UTF-16')) == 12 # The extra character is probably a leading Unicode byte-order mark (BOM).</lang>


====Character Length====
====Character Length====