Jump to content

String length: Difference between revisions

Undo revision 110843 by 207.10.18.77 (talk)
(Undo revision 110843 by 207.10.18.77 (talk))
Line 1,396:
 
# 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====
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.