如图所示,在把dict转成str的时候,反斜杠会多出一个出来,而我现在指向得到原本的那样只有一个反斜杠和一个正斜杠的,求问大佬们如何解决。
3条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
CSDN专家-天际的海浪 2021-06-02 21:01最佳回答 专家已采纳dic = {"aa":"x\/y"} s = str(dic).replace(r'\\','\\') print(s)
采纳该答案 已采纳该答案 专家已采纳评论解决 无用打赏举报微信扫一扫
分享评论登录 后可回复...
查看更多回答(2条)
报告相同问题?
提交
相关推荐 更多相似问题
- 2021-06-02 19:28回答 3 已采纳 dic = {"aa":"x\/y"} s = str(dic).replace(r'\\','\\') print(s)
- 2022-04-10 11:23回答 4 已采纳 print("This is the backslash\"") 输出 This is the backslash"是正确的啊所谓转义,就是让这些原本的特殊字符不作为特殊字符使用。所以双引号加斜
- 2022-02-24 17:00回答 4 已采纳 1.作为路径,/与\是完全相同的,没必要转换,转换了是自找麻烦2.非要写成\,那么要么前面加个r防止转义,要么所有的\都写成\\
- 2020-12-10 08:41weixin_39709674的博客 当你用print (Configurations),它将打印出字典的repr()值你会得到{'javax.jdo.option.ConnectionDriverName': 'org.mariadb.jdbc.Driver', 'javax.jdo.option.ConnectionUserName': 'test', 'javax.jdo.option....
- 2020-11-29 14:21梦中加冕的博客 Update after comments: I am getting this string from a library written in python (python-mingus) using node-python. As I understand from the answers and the comments, there is no way to parse the ...
- 2020-11-29 19:00weixin_39789327的博客 前言python本身使用 \ 来转义一些特殊字符,比如在字符串中加入引号的时候s = 'i\'m superman'print(s) # i'm superman为了防止和字符串本身的引号冲突,使用 \ 来转义,一般情况下这个也不会引起什么问题,但是当你...
- 2016-07-27 16:27回答 4 已采纳 二了,直接awk '{print $1}' input.txt 就可以
- 2017-08-01 06:10回答 2 已采纳 You are sending the content of summary as a string so, instead you need to send it as a slice of m
- 2017-11-07 10:04回答 2 已采纳 Try json_decode(your_data) this should work.
- 2020-12-04 04:11weixin_39683172的博客 I want to insert a \ before each quotes in my string to insert it to my SQL database using pymysql. If I don't escape quotes I can not insert strings in my database.For exemple:str = "ok I'm ready"mus...
- 2021-02-09 20:23北風胡馬的博客 知识点:1. "/"左倾斜是正斜杠,"\"右倾斜是反斜杠...(一)目录中的斜杠python读文件需要输入的目录参数,列出以下例子:path1 = r"C:\Windows\temp\python.txt"path2 = r"C:\Windows\temp\python.txt"path3 = "C:\\...
- 2022-03-13 18:00不剪发的Tony老师的博客 Python 中的反斜线字符是一个特殊字符,可以用于组成特殊字符序列,例如 \t 和 \n。反斜线字符可以用于对其他特殊字符进行转义。F-strings 不能在大括号中使用反...原始字符串中的反斜线是普通字符,不具有转义功能。
- 2021-06-04 22:28回答 2 已采纳 可以用字符串替换方法,先把/全部替换成空的字符,应该就能解决你的问题啦。
- 2016-10-12 10:06回答 3 已采纳 Use the function filepath.ToSlash to replace the operating system path separator with '/' in a pat
- 2014-03-27 13:00回答 2 已采纳 You've said what you quoted above is a string, but it's unclear whether you mean this (shortened a
- 2022-02-19 15:27钢铁大脑袋的博客 在python中,如何用斜杠和反斜杠来写文件路径
- 2020-03-05 12:00lq1340817945的博客 原因:进行了两次或两次以上序列化,解决:不要多次Tojson();可以new两次JsonData完成需求;如: JsonData data = new JsonData(); data[“data2”] = new JsonData();
- 2020-12-09 13:12weixin_39906521的博客 python如何输出反斜杠,斜杠,字符串,引号,几个,写法python如何输出反斜杠易采站长站,站长之家为您整理了python如何输出反斜杠的相关内容。python本身使用 \ 来转义一些特殊字符,比如在字符串中加入引号的时候s = 'i...
- 2021-05-30 18:05回答 1 已采纳 选B,如有帮助,请采纳
- 2021-03-18 21:32code_kd的博客 大家在开发Python的过程中,一定会遇到很多反斜杠的问题,很多人被反斜杠的数量搞得头大。 首先我们写一段非常简单的Python代码,它的作用是把一个字段先转换为JSON格式的字符串,然后把这个字符串再转换为JSON格式...
- 没有解决我的问题, 去提问