PyRun_SimpleString();是一个简单的执行python脚本命令的函数。
PyRun_SimpleString("f=open('D:\1234567890123456\abc.py','r',encoding='utf8')");
这一句是打开'D:\1234567890123456\abc.py'文本。但python执行的时候会报错:
Invalid argument:'D:S4567890123456\x07bc.py'
这是因为,python在解析时,把\123当作‘S’字符了('S'的ascii码是123),同理将\a处理成\x07。
因此我们要将D:\1234567890123456\abc.py中的‘\’替换成'\\'或者替换成'/'就可以了
D:\\1234567890123456\\abc.py
或
D:/1234567890123456/abc.py