程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

字典(0)

文件(0)

标签  

字典(0)

文件(0)

日期归档  

100行的加强型字符串 python实用脚本下载

发布于2019-08-20 17:45

下载

前言

100行的加强型字符串。

用法

from sstr import SuperStr

print SuperStr('{"name" : "mike"}').json() # {u'name': u'mike'}
print SuperStr('1').int() # 1
print SuperStr(pickle.dumps(object())).object() # <object object at 0x1043330d0>
print SuperStr('123').list() # ['1', '2', '3']
print SuperStr('aabbbc').most_common(2) # [('b', 3), ('a', 2)]
print SuperStr('exists').exists('t') # True
print SuperStr('ababab').findall('ab') # ['ab', 'ab', 'ab']
print SuperStr('ab,ab,ab').split(',') # ['ab', 'ab', 'ab']
print SuperStr('ab,ab,ab').sub(',', '') # ababab
print SuperStr('ab,ab,ab').count('a') # 3
print SuperStr('reverse').sort().reverse() # vsrreee
print SuperStr('abc').permutations() # <itertools.permutations object at 0x1046a7830>
# capitalize
# center
# count
# decode
# encode
# endswith
# expandtabs
# find
# format
# index
# isalnum
# isalpha
# isdigit
# islower
# isspace
# istitle
# isupper
# join
# ljust
# lower
# lstrip
# partition
# replace
# rfind
# rindex
# rjust
# rpartition
# rsplit
# rstrip
# split
# splitlines
# startswith
# strip
# swapcase
# title
# translate
# upper
# zfill


所属网站分类: python资源下载 > 脚本

作者:smile

链接:https://www.pythonheidong.com/blog/article/49485/241e5767da398e273035/

来源:python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

0 0
收藏该文
已收藏

评论内容:(最多支持255个字符)