def fun_getBinCountToProject(): with open("../aps/application/radisson/formal/sys_common_guiobj/app_guiobj_setup.c", "r") as project_op: temStr = '#define CONFIG_FLASH_BIN_COUNT ' + str(len(g_listBin)); content = project_op.read(); pos = content.find('#define CONFIG_FLASH_BIN_COUNT'); if pos != -1: pos_end = content[pos:].find('\n'); content = content[:pos] + temStr + content[pos + pos_end:]; with open("../aps/application/radisson/formal/sys_common_guiobj/app_guiobj_setup.c","w") as project_op: project_op.write(content);