python 中join()转义的问题,pythonjoin,t = ['[', '"
python 中join()转义的问题,pythonjoin,t = ['[', '"
t = ['[', '"', '123', '"', ',"', 'haha', '"', ',"', '"', ',"', '**\\t', '"', ',"', '3709**********3125', '"', ',"', '', '"', ']']print "".join(t)>>> ["123","haha","","**\t","3709**********3125",""]
有什么办法可以让join返回的的时候不转义\,返回原始值么?
可以使用
'{!r}'.format(s)
使s不转义,对列表来说可以
t = list(map(lambda s:'{!r}'.format(s),t))
来统一处理。
编橙之家文章,
相关内容
- Django框架自带了wsgi.py 为什么部署还需要uWSGI呢?,dj
- python autopy3 出现异常ValueError: Point out of bounds,autopy3v
- python 源码混淆一般用什么比较工具好?,python源码,pyt
- python 收到的数据是b'\x81\x84t\xdeL\x16\x00\xbb这种数据怎么
- celery可以动态的添加任务吗,celery动态任务,celery可以动
- python超速遍历文件夹下面三十几万个txt文档的处理,
- 关于Python类中super的问题?,python类super问题,In [1]: cl
- 用户名跟ID都可以登录的sql语句怎么样来写?,sql语句
- 在python里面如果更好的进行字符过滤?,python字符,比如
- python写一个递归函数,python写递归函数,a = [1, 2, 3
评论关闭