def SegByName(segname):
    seg = idaapi.get_segm_by_name(segname)

    if not seg:
        return BADADDR

    return seg.sel
Get segment by name
dataset/ETHPy150Open EiNSTeiN-/idapython/python/idc.py/SegByName