Export to GitHub

zhpy - issue #8

用 unicode 值来转换中文


Posted on Aug 22, 2007 by Massive Bird

考虑是用 p_数字_v 来作为转换后的名字, 数字是 unicode 值, 这样无须字典就可以双向转换。

Attachments

Comment #1

Posted on Aug 23, 2007 by Grumpy Bear

修改一下,

  • 向前相容(map以後要被拿掉)
  • 16進制

{{{ def variable_to_number(tmp): """ convert variable to hex number """ word_list=[] for i in tmp: ori = str(hex(ord(i)))[2:] word_list.append(ori) return "_".join(word_list) }}}

Status: Verified

Labels:
Type-Enhancement Priority-Medium