python之再学习----简单的字符串

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())

直接贴代码,以后遇见好的还会继续补充
posted @ 2018-02-23 19:57  super-JAVA  阅读(207)  评论(0编辑  收藏  举报