小编Hem*_*hah的帖子

在Python中用空格分隔key = value字符串创建字典

我有如下字符串:

s = 'key1=1234 key2="string with space" key3="SrtingWithoutSpace"'
Run Code Online (Sandbox Code Playgroud)

我想转换成字典如下:

key  | value
-----|--------  
key1 | 1234
key2 | string with space
key3 | SrtingWithoutSpace

我如何在Python中执行此操作?

python dictionary

12
推荐指数
2
解决办法
2万
查看次数

标签 统计

dictionary ×1

python ×1