说明:Python中对首字母大写用:capitalize,对某段字母大写在字符串中加:.upper(),小写加:.lower()
具体例子如下:
infos = 'aabbbbccccc'
print(infos.upper())
print(infos.capitalize())
print(infos.lower())
j=int(input('input the capitalize sequence:'))
#for j in infos:
# 定义从哪个位置起开始大写
ret = infos[0:j-1].lower()+infos[j].upper()+infos[j+1:].lower()
print(ret)
print('***********************************************************')
来源:https://www.cnblogs.com/chao-hbc/p/12388513.html