用于字符串处理的包python

string-handling的Python项目详细描述


字符串处理

安装

$ pip install string_handling

用法

fromstring_handlingimportfind,formatformat.del_accents(text)# Return a string with the deleted accentsfind.palindromes(msg,delimiter=None,diff_cl=False)# Returns a dictionary with the palindromes and your respective counts.# For example {palindrome_1: count, palindrome_2: count}.find.letters(str,letter=None,diff_cl=False):# Returns a dictionary with the letter(s) and your respective counts.# For example {letter_a: count_a, letter_b: count_b}.

示例

>>> from string_handling find, format
>>> # function del_accents
>>> format.del_accents('áéíóúÁÉÍÓÚâêîôûÂÊÎÔÛãẽĩõũÃẼĨÕŨçÇ')'aeiouAEIOUaeiouAEIOUaeiouAEIOUcC'
>>> # function palindromes
>>> find.palindromes('arara'){'arara': 1}
>>> find.palindromes('A madam, a boy, a mom; racecar', ' |, |; '){'A': 3, 'madam': 1, 'mom': 1, 'racecar': 1}
>>> find.palindromes('A madam, a boy, a mom; racecar', ' |, |; ', True){'A': 1, 'madam': 1, 'a': 2, 'mom': 1, 'racecar': 1}
>>> # function letters
>>> find.letters('A madam, a boy, a mom; racecar', 'a'){'a': 7}
>>> find.letters('A madam, a boy, a mom; racecar', 'a', True){'a': 6}
>>> find.letters('adam, boy, moM', diff_cl=True){'a': 2, 'd': 1, 'm': 2, ',': 2, ' ': 2, 'b': 1, 'o': 2, 'y': 1, 'M': 1}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java与Groovy正则表达式匹配混淆   java控制台未定义为JSNI   主目录中的java指针异常   java如何获取hashmap中的arrayList的大小   ApachePOI用于文本,Java代码中的word doc(.docx)中没有进行追加   Ruby对象到Java对象   JavaSpringJPA哈希集只返回一个值   Java在执行由配置了精确类路径参数的mavenjarpluin生成的可执行jar时无法找到依赖项   java我试图在画布上写一个文本,但什么也没发生   java HTTP 404源服务器找不到目标资源的当前表示形式,或者不愿意透露存在该表示形式。不起作用   java提取小数点后的最后一个数字   oop Java:无法访问对象的元素   PHP URL中RecyclerView中的java句柄空异常   不调用OnCreateViewHolder的java Update RecyclerView适配器项