s = "woxiaoe"
print len(s)
print "s[0] " + s[0] + '\t' + 's[1] ' + s[1];
print "s[-1] " + s[-1] + '\t' + 's[-2] ' + s[-2];
print s*10
print 'asS'.isalpha();
print dir(s);
help(s.decode)
msg = '''
adsfsafas"""asdafa"""dddd
sdfs'''
print msg
输出
7
s[0] w s[1] o
s[-1] e s[-2] o
woxiaoewoxiaoewoxiaoewoxiaoewoxiaoewoxiaoewoxiaoewoxiaoewoxiaoewoxiaoe
True
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', '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']
Help on built-in function decode:
decode(...)
S.decode([encoding[,errors]]) -> object
Decodes S using the codec registered for encoding. encoding defaults
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
as well as any other name registered with codecs.register_error that is
able to handle UnicodeDecodeErrors.
adsfsafas"""asdafa"""dddd
sdfs
分享到:
相关推荐
主要介绍了C语言字符串转换为Python字符串的方法,文中讲解非常细致,代码帮助大家更好的理解和学习,感兴趣的朋友可以了解下
实例如下: # bytes object b = bexample # str object s = example ...以上这篇python字符串str和字节数组相互转化方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多
Python字符串操作常用函数,包含了检索、统计、分割、替换、大小写转换、对齐,空格删除、字符串判断(头尾+组成)
python字符串学习笔记.python字符串操作方法
python字符串操作.pdf
python字符串学习笔记
大熊课堂,关于 python 字符串的课件
Python字符串调用方法解释(部分),因为本人使用的是3.1版,很多旧版的调用方法新版不支持,所以只有些基础的调用和代码运行的截图,比较适合和我一样的菜鸟级的童鞋观摩。
python字符串处理实例.docx
python字符串, 列表, 字典, 集合方法说明
python字符串基本操作 Python字符串基本操作 Python是一种高级编程语言,它支持多种数据类型,其中字符串是最常用的数据类型之一。字符串是由一系列字符组成的,可以包含字母、数字、符号等。在Python中,字符串是不...
python字符串的使用方法 Python字符串的使用方法 Python是一种高级编程语言,它支持多种数据类型,其中字符串是最常用的数据类型之一。字符串是由一系列字符组成的,可以包含字母、数字、符号等。在Python中,字符串...
python字符串操作实方法大合集,包括了几乎所有常用的python字符串操作,如字符串的替换、删除、截取、复制、连接、比较、查找、分割等,需要的朋友可以参考下。
Python 字符串深度总结Python 字符串深度总结
1、本文主要讲解了关于字符串str的知识点,包含创建字符串、访问字符串、字符串基础知识、以及字符串的内置函数和内置方法。 2、本文件是markdown文件,是本人辛辛苦苦整理出来的,一份耕耘一分收获。 3、不要盗用,...
Python字符串常用方法汇总.docxPython字符串常用方法汇总.docxPython字符串常用方法汇总.docxPython字符串常用方法汇总.docxPython字符串常用方法汇总.docxPython字符串常用方法汇总.docxPython字符串常用方法汇总....
python第三章,字符串的简单处理及应用。以及数据类型
Python中使用多种方式对某一字符串的字符进行统计,实现字符串冗余字符统计,输出执行时间和内容字典
python实现字符串模糊匹配
python字符串查找函数的使用 打开Python开发工具IDLE,新建‘findstr.py’文件,并写代码如下: s ='/ab/bx,.s' print (s.find('/x')) 注意find是匹配子字符串,而不是匹配第一个字符 F5运行程序,打印出-1,代表...