鱼C论坛

 找回密码
 立即注册
查看: 644|回复: 1

其中字符串的strip方法在3.7中修改了么?

[复制链接]
发表于 2018-12-19 16:51:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
其中我的字符串前边有换行和制表符,直接使用strip()方法就把他们都删除了,不是默认只删除空格么?

  1. >>> abc
  2. '\r\n\t\t\t\r\n                                    Scripts, examples and news about Python programming for the Windows platform.\r\n'
  3. >>> abc.strip()
  4. 'Scripts, examples and news about Python programming for the Windows platform.'
  5. >>> help(abc.strip)
  6. Help on built-in function strip:

  7. strip(chars=None, /) method of builtins.str instance
  8.     Return a copy of the string with leading and trailing whitespace remove.
  9.    
  10.     If chars is given and not None, remove characters in chars instead.
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2018-12-19 16:55:22 | 显示全部楼层
删除的是空白不只是空格
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 11:59

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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