Matching a variable to a list and save the match
<p>newbie question,I have the following code where I need to match the data in variable gerrit with the list gerrit_refs and get the corresponding match and save in a variable,how can I do that?</p>

<pre><code>'''
gerrit_refs:
refs/changes/89/202089/4
refs/changes/39/205739/2
refs/changes/94/195594/6
refs/changes/90/202090/4
refs/changes/92/202092/4
'''

def main ():
    gerrit=205739
    with open('gerrit_refs.txt', 'r') as f:
        # Here we make a list of refs based on the file
        gerrit_refs = [line.strip() for line in f]
    match = None
    for ref in gerrit_refs:
        if gerrit in ref:
            match = ref
            print match
            break

if __name__ == '__main__':
    main()
</code></pre>

<p>Error:-</p>

<p>TypeError: 'in ' requires string as left operand, not in</p>
