python¶ÁxmlÖÐÔªËØË³ÐòÎÊÌâ
a.xmlÄÚÈÝÈçÏÂ:
</project>
<project name="asdf" branch="asfasdfas" naname="xiao xin" QD6="091010">
<componentList table="cpp">
<entry>ae </entry>
<entry>pl </entry>
<entry>pp </entry>
<entry>ps </entry>
<entry>sa </entry>
</componentList>
<componentList table="java">
</componentList>
</project>
ÏàÓ¦µÄ´¦Àíº¯ÊýÈçÏ£º
def GetexpectData(project,branch):
global locList
global cppcomponentss,componentReposityy;
cppcomponentss= {}
tree = ET.parse("a.xml")
p = getByAttr(tree.findall("project"),"name",project)
if p!=None:
compList = getByAttr(p.findall("componentList"),"table","cpp")
comps = compList.findall("expect")
for each in comps:
&
Ïà¹ØÎÊ´ð£º
ÎÒÓÃ
#include "python.h"
Py_Initialize();
PyRun_SimpleString("execfile('x.py')");
Íâ´øpython2.6.dllÕâÖÖ·½Ê½ÈÃc++ǶÈëpython£¬·¢²¼³ÌÐòµÄʱºò£¬¾ÓÈ»»¹ÊÇҪװpython£ ......
ÁÄÁÄ£¬ÎÒÒ»Ö±²»ÊǺÜÀí½âΪʲô¶¯Ì¬ÓïÑԾͲ»ÐèÒª½Ó¿Ú£¬ÎÒÖ»ÊÇ´Ó½¨Ä£µÄ½Ç¶È¿¼ÂÇ£¬½Ó¿ÚÊÇÒ»ÖÖºÏÀíµÄ½¨Ä£·½Ê½Ñ½£¬ÌرðÊÇ´óµÄÏîÄ¿£¬¶øÇÒ´úÂëÈÝÒ×ά»¤¡£Ïà±È½Ó¿Ú¶àÖØ¼Ì³ÐÊÇÒ»ÖÖºÜÔã¸âµÄ·½Ê½¡£ÎªÊ²Ã´¶¯Ì¬ÓïÑԾͲ»ÐèÒª½Ó¿Ú£¬ ......
d = {"a":"a","b":"b","c":"c"}
print d
ΪʲôÊä³öÊÇ:{'a': 'a', 'c': 'c', 'b': 'b'} ......
ǰ¼¸Ìì¸Õ¸Õ½Ó´¥Python£¬ºÃ¶àÎÊÌâ²»Ã÷°×
´úÂëÈçÏ£¬¿ÉÒÔÕý³£Êä³ösheetname.Èç¹û°Ñ±àÂ뷽ʽ¸Ä³Éutf16¾Í»á±¨´í
TypeError: compile() expected string without null bytes
ÇëÎÊÊÇΪʲô£¿
»¹ÓÐÊä³öµØÄÚÈÝÊÇ ......