2006年02月14日 星期二 16:57
比如我想实现 VBScript 类似这样的操作: MsgBox(Asc("a")) MsgBox(Chr(97)) 这两句的结果分别是 97, "a" 请问在 python 中怎么写? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060214/0ed03c3b/attachment.htm
2006年02月14日 星期二 17:01
On 2/14/06, Neil <chenrong2003 at gmail.com> wrote: > 比如我想实现 VBScript 类似这样的操作: > > MsgBox(Asc("a")) ord('a') > MsgBox(Chr(97)) > chr(97) > 这两句的结果分别是 97, "a" > > 请问在 python 中怎么写? 建议多看一看built-in函数文档,多读几遍。 -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit
2006年02月14日 星期二 17:40
多谢! 我目前还没看完,大概看了 1/3 了,感觉收获挺大。要细细阅读,呵。 On 2/14/06, limodou <limodou at gmail.com> wrote: > > On 2/14/06, Neil <chenrong2003 at gmail.com> wrote: > > 比如我想实现 VBScript 类似这样的操作: > > > > MsgBox(Asc("a")) > > ord('a') > > > MsgBox(Chr(97)) > > > chr(97) > > > 这两句的结果分别是 97, "a" > > > > 请问在 python 中怎么写? > > 建议多看一看built-in函数文档,多读几遍。 > > -- > I like python! > My Blog: http://www.donews.net/limodou > NewEdit Maillist: http://groups.google.com/group/NewEdit > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060214/2f359c32/attachment.htm
2006年02月14日 星期二 17:46
chr(i) 将一个0到255的整数转换为一个字符. ord(c) 返回单个字符c的整数顺序值.普通字符返回[0,255]中的一个值,Unicode字符返回 [0,65535]中的一个值 unichr(i) 将一个0到65535的整数转换为一个Unicode字符 是不是这个? 在06-2-14,Neil <chenrong2003 at gmail.com> 写道: > > 多谢! > > 我目前还没看完,大概看了 1/3 了,感觉收获挺大。要细细阅读,呵。 > > > On 2/14/06, limodou <limodou at gmail.com> wrote: > > > On 2/14/06, Neil <chenrong2003 at gmail.com> wrote: > > > 比如我想实现 VBScript 类似这样的操作: > > > > > > MsgBox(Asc("a")) > > > > ord('a') > > > > > MsgBox(Chr(97)) > > > > > chr(97) > > > > > 这两句的结果分别是 97, "a" > > > > > > 请问在 python 中怎么写? > > > > 建议多看一看built-in函数文档,多读几遍。 > > > > -- > > I like python! > > My Blog: http://www.donews.net/limodou > > NewEdit Maillist: http://groups.google.com/group/NewEdit > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- Andelf BLOG:http://blog.sohu.com/members/andelf/ BLOG:http://spaces.msn.com/members/andelf -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060214/371fdd1d/attachment-0001.htm
2006年02月14日 星期二 18:12
thanks, Andalf. That's exactly what I what. On 2/14/06, Andelf <andelf at gmail.com> wrote: > > chr(i) > 将一个0到255的整数转换为一个字符. > ord(c) > 返回单个字符c的整数顺序值.普通字符返回[0,255]中的一个值,Unicode字符返回 [0,65535]中的一个值 > unichr(i) > 将一个0到65535的整数转换为一个Unicode字符 > 是不是这个? > > 在06-2-14,Neil <chenrong2003 at gmail.com> 写道: > > > > 多谢! > > > > 我目前还没看完,大概看了 1/3 了,感觉收获挺大。要细细阅读,呵。 > > > > > > On 2/14/06, limodou < limodou at gmail.com> wrote: > > > > > On 2/14/06, Neil <chenrong2003 at gmail.com> wrote: > > > > 比如我想实现 VBScript 类似这样的操作: > > > > > > > > MsgBox(Asc("a")) > > > > > > ord('a') > > > > > > > MsgBox(Chr(97)) > > > > > > > chr(97) > > > > > > > 这两句的结果分别是 97, "a" > > > > > > > > 请问在 python 中怎么写? > > > > > > 建议多看一看built-in函数文档,多读几遍。 > > > > > > -- > > > I like python! > > > My Blog: http://www.donews.net/limodou > > > NewEdit Maillist: http://groups.google.com/group/NewEdit > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to > > > python-chinese-request at lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > -- > Andelf > BLOG:http://blog.sohu.com/members/andelf/ > BLOG:http://spaces.msn.com/members/andelf > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060214/d17edff8/attachment.html
2006年02月17日 星期五 09:32
On 2/14/06, Neil <chenrong2003 at gmail.com> wrote: > 比如我想实现 VBScript 类似这样的操作: > > MsgBox(Asc("a")) > MsgBox(Chr(97)) > > 这两句的结果分别是 97, "a" > > 请问在 python 中怎么写? 还有一个库binascii很好用的,可以批量转换: >>> import binascii >>> binascii.b2a_hex('leo') '6c656f' >>> binascii.a2b_hex('6c656f') 'leo' -- Best Regards, Leo Jay
Zeuux © 2025
京ICP备05028076号