Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.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 3.x 从MongoDB字符串中以字符串形式执行Python代码无效_Python 3.x_String_Mongodb_Exec - Fatal编程技术网

Python 3.x 从MongoDB字符串中以字符串形式执行Python代码无效

Python 3.x 从MongoDB字符串中以字符串形式执行Python代码无效,python-3.x,string,mongodb,exec,Python 3.x,String,Mongodb,Exec,我在Python中的代码有问题,我需要从MongoDB的字符串提取执行Python代码,但我有一个语法错误: def test():\n\treturn "hello"\nresult = test()\n File "<string>", line 1 SyntaxError: unexpected character after line continuation character 字符串变量Python内容组件['Python']

我在Python中的代码有问题,我需要从MongoDB的字符串提取执行Python代码,但我有一个语法错误:

def test():\n\treturn "hello"\nresult = test()\n 
File "<string>", line 1 
SyntaxError: unexpected character after line continuation character
字符串变量Python内容组件['Python']:

def test():\n\treturn "ici"\nresult = test()\n
我尝试过许多解决办法,但没有找到一个

def test():\n\treturn "ici"\nresult = test()\n