摘要: Python中的字符串对象提供了许多内置的方法,用于操作和处理字符串。以下是一些常用的字符串方法及其示例: 1. split() 将字符串分割为子字符串列表,并返回该列表。 s = "Hello World" words = s.split() # 默认按空格分割 print(words) # 输出 阅读全文
posted @ 2024-03-15 09:20 nxhujiee 阅读(124) 评论(0) 推荐(0)