import string


def first_int(s):
    """Return the first integer in a string, or None"""
    # This technique appears to be faster than the re-based method 
    # by almost an order of magnitude. Prefer it 
    ret = ''
    for c in s:
        if c in string.digits:
            ret += c
        else:
            break
    if len(ret) > 0:
        return int(ret)
    else:
        return None