鱼C论坛

 找回密码
 立即注册
查看: 52328|回复: 2

关于字符串的split用法,提示“'str' object has no attribute 'spilt'”

[复制链接]
发表于 2016-3-2 22:43:04 | 显示全部楼层 |阅读模式
2鱼币
  1. lines=input('请输入需要显示的行数【格式如13:21或:21或21:】:')

  2. list1=lines.spilt(':',1))

  3. print(list1)
复制代码

执行结果:
请输入需要显示的行数【格式如13:21或:21或21:】:12:31
Traceback (most recent call last):
  File "E:\qq.py", line 4, in <module>
    print(lines.spilt(':',1))
AttributeError: 'str' object has no attribute 'spilt'
为什么?
但是以下操作是正确的啊?
>>> str1='12:31'
>>> str1.split(':',1)
['12', '31']
>>>

最佳答案

查看完整内容

你拼写错误,split写成spilt了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2016-3-2 22:43:05 | 显示全部楼层
你拼写错误,split写成spilt了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2016-3-2 23:30:56 | 显示全部楼层
冬雪雪冬 发表于 2016-3-2 23:06
你拼写错误,split写成spilt了

哦哦哦,嘿嘿,我是大马虎。。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-9-26 04:10

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表