Python脚本编写遇到问题汇总
20170630
def List2Any(self,num): pass #《1、缺失后 无法执行,会报错:IndentationError: expected an indented block》 def identRorO(self,list): print (list) for li in list: an = re.match('^[a-zA-Z]{1}\d{1}$', li) if (an != None) and (re.match('^[R]$',li[0]) != None): listR = self.List2dict_R(int(li[1])) elif (an != None) and (re.match('^[O]$',li[0]) != None): listO = self.List2dict_O(int(li[1])) #《缺少 右括号,报错:SyntaxError: invalid syntax,同时证报错有几率出现在 __main__函数的位置》 listR.update(listO) print (listR) if __name__=='__main__': c=createdata() li=['aB5','4ddd','3C','acd23','R2','J8','O3'] c.identRorO(li)