# -*- coding: utf-8 -*-
"""
Created on Mon May 6 17:33:30 2019
@author: Administrator
"""
ss='this is sample No.1'
# 第一个字母转为大写
print(ss.capitalize())
# 转换所有字母为小写
print(ss.casefold())
# 居中
print(ss.center(30))
# 子串出现的次数
print(ss.count('s', 0, len(ss)))
# 分割为元祖
print(ss.partition('is'))
运行:
This is sample no.1
this is sample no.1
this is sample No.1
3
('th', 'is', ' is sample No.1')