print("today is 2018.2.22")
name = ‘SUPer‘
print(‘hello,‘+name+‘ today is good or not?‘)
# 全部都是小写 string.lower()
print(name.lower())
# 全部都是大写 string.upper
print(name.upper())
# 首字母是大写 string.title
print(name.title())
# 用三个‘‘‘ ‘‘‘可以让‘ ‘‘转义
print(‘‘‘Alert said,"a person who never made a mistake never tried anything new."‘‘‘)
famous_person = ‘Alert said,"a person who never made a mistake never tried anything new."‘
message = famous_person + ‘balabala‘
print(message)
testname = r‘ super\tsu ha\nha ‘
print(testname.lstrip())
print(testname.rstrip())
print(testname.strip())
直接贴代码,以后遇见好的还会继续补充
python之再学习----简单的字符串
Posted superblog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python之再学习----简单的字符串相关的知识,希望对你有一定的参考价值。
以上是关于python之再学习----简单的字符串的主要内容,如果未能解决你的问题,请参考以下文章