一、字符串的使用以及使用方法 """ 关于字符串的练习 """ first_name = 'Zhou'last_name = 'zhou'full_name = first_name+last_name print("Hello " + first_name +"," + " WellCome to Python!") print(first_name+' full name is :'+
一、字符串的使用以及使用方法
""" 关于字符串的练习
"""
first_name = 'Zhou'last_name = 'zhou'full_name = first_name+last_name
print("Hello " + first_name +"," + " WellCome to Python!")
print(first_name+' full name is :'+full_name.title())
"""字符串大小转换
"""Strings_test = 'abcdef'print(Strings_test.title())
print(Strings_test.upper())
print(Strings_test.lower())
"""添加空白
"""print('do it!')
print('\tdo it!')
print('I will do it!')
print('I will\ndo it!')
"""删除字符串空白
"""test_string = ' asdsa dasda 'print(test_string+'删除尾部空白前')
print(test_string.rstrip()+'删除尾部空白后')
print('删除首部空白前'+test_string)
print('删除首部空白前'+test_string.lstrip())
print(test_string+'删除首尾部空白前')
print(test_string.strip()+'删除首尾空白后')