字符串操作

课程:Python · 编程练习

Python编程练习 - 字符串操作

练习内容

# 字符串的常用操作\ntext = "Hello Python"\n\nprint(f"转大写: {text.upper()}")\nprint(f"转小写: {text.lower()}")\nprint(f"替换: {text.replace('Python', 'World')}")\nprint(f"分割: {text.split()}")\nprint(f"字符串长度: {len(te