I need to ...
1) Truncate long unicode (UTF-8) strings based on their length in
BYTES. For example, u'\u4000\u4001\u4002 abc' has a length of 7 but
takes up 13 bytes. Since u'\u4000' takes up 3 bytes, I want truncate
(u'\u4000\u4001\u4002 abc',3) == u'\u4000' -- as compared to
u'\u4000\u4001\u4002
Newbie question:
Let's say I open a new file for writing in a certain path. How do I
get that path back?
Example:
>>> f = open('/some/path/file.ext')
>>> some_function(f)
'/some/path/file.ext'
Does some_function(f) already exist? And if not, how would I define
it?
-- Andrew
--
http://mail.pyth