Py学习  »  Python

如何使用Python RE从字符串中删除多余的换行符和制表符

Winston • 2 年前 • 690 次点击  

给定一个Python字符串,例如:

"good \nand bad and\n\t not great and awesome"

我想把它分成一个数组 and s、 同时也移除了杂散的 \n 还有 \t s:

["good", "bad", "not great", "awesome"]

如何使用 re.split() ?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/130632
 
690 次点击  
文章 [ 2 ]  |  最新文章 2 年前