Python中的可变字符串 [英] Mutable strings in Python

查看:159
本文介绍了Python中的可变字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拜托,您知道提供可变字符串的Python库吗? Google惊人地返回了很少的结果.我发现的唯一可用的库是 http://code.google.com/p/gapbuffer/是用C语言编写的,但我希望它是用纯Python编写的.

Please, do you know of a Python library which provides mutable strings? Google returned surprisingly few results. The only usable library I found is http://code.google.com/p/gapbuffer/ which is in C but I would prefer it to be written in pure Python.

感谢您的答复,但我追求的是效率库.也就是说,''.join(list)可能有效,但是我希望有一些更优化的东西.此外,它还必须支持常规字符串所做的常规操作,例如regex和unicode.

Thanks for the responses but I'm after an efficient library. That is, ''.join(list) might work but I was hoping for something more optimized. Also, it has to support the usual stuff regular strings do, like regex and unicode.

推荐答案

在Python中,可变序列类型为 bytearray ,请参见

In Python mutable sequence type is bytearray see this link

这篇关于Python中的可变字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆