Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为python打印不带引号的json值_Python_Json - Fatal编程技术网

为python打印不带引号的json值

为python打印不带引号的json值,python,json,Python,Json,我有以下json: { "email": "lalalalal@gmail.com" } 和小测试脚本: file = open('/Users/user/PycharmProjects/Test/newfile.json') x = json.load(file) y = repr(x['email']) print('My test email is ' + y) 我收到下一个输出: My test email is 'lalalalal@gmail.com' 我的问题是: 如何接

我有以下json:

{
  "email": "lalalalal@gmail.com"
}
和小测试脚本:

file = open('/Users/user/PycharmProjects/Test/newfile.json')
x = json.load(file)
y = repr(x['email'])
print('My test email is ' + y)
我收到下一个输出:

My test email is 'lalalalal@gmail.com'
我的问题是:

如何接收JSON值数据(也打印)而不在输出中使用普通引号

接收:


我的测试电子邮件是lalalalal@gmail.com

您不应该使用repr。无需repr即可获得值

x['email']

您没有使用
repr()
!抱歉,不明白…请删除
repr()
调用。这就是添加引号的地方。谢谢,没关系!