#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "DaChao"
# Date: 2017/6/7
# x = "234567ASDsdfghj" #切片和索引
# print(x[2:-2])
# print(x[2])
# x = "hello" #显示字符串长度,注意是从1开始
# print(len(x))
# x = "hello world ASDF" #返回长度为100的字符串,并在右侧填充0
# print(x.zfill(100))
# x = "hello world ASDF" #小写变为大写
# print(x.upper())
# x = "234567ASDsdfghj" #大写变为小写
# print(x.lower())
# x = "234567sdfghj" #判断是否含有至少一个区分大小写的字符,并且这些都是小写
# # print(x.islower())
# x = "hello world" #返回标题化字符串
# print(x.title())
# x = "Hello World" #翻转字符串中的大小写
# print(x.swapcase())
# x = " hello world " #同时执行lstrip和rstrip,删除两边
# print(x.strip())
# x = "hello world" #检测开头或结尾
# print(x.startswith('hea'))
# x = "hello world"
# print(x.endswith('o',0,5))
# x = "234567ASDsd\nfASDghjASD" #以\n行分隔,返回一个包含元素的列表
# print(x.splitlines(True))
# x = "234567ASDsdfASDghjASD" #以A分隔x,并可指定次数
# print(x.split('A',2))
# x = "234567ASDsdfASDghjASD" #替换字符串,并且可指定次数
# print(x.replace('ASD','ABC',1))
# x = "234567ASDsdfghj" #以7为中间符,分割x
# print(x.partition('7'))
# x = "234567ASDZzsdfghj" #返回x中最大的字母(小写)
# print((max(x)))
# x = "121 234567ASDsdfghj" #截掉x左边的1
# print(x.lstrip('1'))
# x = "234567sdfghj" #左对齐,并以*填充剩余数量(20)
# print(x.ljust(20,'*'))
# x = "*" #以x为分隔符重新生成y
# y = "abc"
# print(x.join(y))
# x = "Asdf112321 Gh123J" #判断是否首字符为大写,其它为小写
# print(x.istitle())
# x = " " #判断是否只包含空格
# print(x.isspace())
# x = "234567f" #判断是否只包含*数字字符*
# print(x.isnumeric())
# x = "234567" #判断是否全为数字
# print(x.isdigit())
# x = "234567sdfghj" #判断是否全为十进制数字
# print(x.isdecimal())
# x = "234567sdfghj" #判断是否全为字母
# print(x.isalpha())
# x = "234567sdfghj" #判断是否全为字母或数字
# print(x.isalnum())
# x = "hello world" #index同find,但查不到,会返回异常!!!
# print(x.index('a'))
# x = "hello world" #find查找字符串并返回索引值
# print(x.find('d'))
# x = "name:{2},age:{1},sex:{0}" #format格式化字符串
# print(x.format('chao','18','male'))
# x = "name:{},age:{},sex:{}"
# print(x.format('chao','18','male'))
# x = "hello \tworld" #\t tab符号b 把字符串中的 tab 符号('\t')转为空格,tab 符号('\t')默认的空格数是 8。
# print(x.expandtabs(100))
# x = "hello world" #在指定范围内,返回l的次数
# print(x.count('l',3,10))
# x = "hello world" #中间插入字符串,两边填充*
# print(x.center(30,'*'))
# -*- coding: utf-8 -*-
# __author__ = "DaChao"
# Date: 2017/6/7
# x = "234567ASDsdfghj" #切片和索引
# print(x[2:-2])
# print(x[2])
# x = "hello" #显示字符串长度,注意是从1开始
# print(len(x))
# x = "hello world ASDF" #返回长度为100的字符串,并在右侧填充0
# print(x.zfill(100))
# x = "hello world ASDF" #小写变为大写
# print(x.upper())
# x = "234567ASDsdfghj" #大写变为小写
# print(x.lower())
# x = "234567sdfghj" #判断是否含有至少一个区分大小写的字符,并且这些都是小写
# # print(x.islower())
# x = "hello world" #返回标题化字符串
# print(x.title())
# x = "Hello World" #翻转字符串中的大小写
# print(x.swapcase())
# x = " hello world " #同时执行lstrip和rstrip,删除两边
# print(x.strip())
# x = "hello world" #检测开头或结尾
# print(x.startswith('hea'))
# x = "hello world"
# print(x.endswith('o',0,5))
# x = "234567ASDsd\nfASDghjASD" #以\n行分隔,返回一个包含元素的列表
# print(x.splitlines(True))
# x = "234567ASDsdfASDghjASD" #以A分隔x,并可指定次数
# print(x.split('A',2))
# x = "234567ASDsdfASDghjASD" #替换字符串,并且可指定次数
# print(x.replace('ASD','ABC',1))
# x = "234567ASDsdfghj" #以7为中间符,分割x
# print(x.partition('7'))
# x = "234567ASDZzsdfghj" #返回x中最大的字母(小写)
# print((max(x)))
# x = "121 234567ASDsdfghj" #截掉x左边的1
# print(x.lstrip('1'))
# x = "234567sdfghj" #左对齐,并以*填充剩余数量(20)
# print(x.ljust(20,'*'))
# x = "*" #以x为分隔符重新生成y
# y = "abc"
# print(x.join(y))
# x = "Asdf112321 Gh123J" #判断是否首字符为大写,其它为小写
# print(x.istitle())
# x = " " #判断是否只包含空格
# print(x.isspace())
# x = "234567f" #判断是否只包含*数字字符*
# print(x.isnumeric())
# x = "234567" #判断是否全为数字
# print(x.isdigit())
# x = "234567sdfghj" #判断是否全为十进制数字
# print(x.isdecimal())
# x = "234567sdfghj" #判断是否全为字母
# print(x.isalpha())
# x = "234567sdfghj" #判断是否全为字母或数字
# print(x.isalnum())
# x = "hello world" #index同find,但查不到,会返回异常!!!
# print(x.index('a'))
# x = "hello world" #find查找字符串并返回索引值
# print(x.find('d'))
# x = "name:{2},age:{1},sex:{0}" #format格式化字符串
# print(x.format('chao','18','male'))
# x = "name:{},age:{},sex:{}"
# print(x.format('chao','18','male'))
# x = "hello \tworld" #\t tab符号b 把字符串中的 tab 符号('\t')转为空格,tab 符号('\t')默认的空格数是 8。
# print(x.expandtabs(100))
# x = "hello world" #在指定范围内,返回l的次数
# print(x.count('l',3,10))
# x = "hello world" #中间插入字符串,两边填充*
# print(x.center(30,'*'))