<p><br>
On Mar 2, 2014 6:30 PM, "Mark Lawrence" <<a href="mailto:breamoreboy@yahoo.co.uk">breamoreboy@yahoo.co.uk</a>> wrote:<br>
><br>
> On 02/03/2014 21:10, Tyler Simko wrote:<br>
>><br>
>> Hi all!<br>
>><br>
>> I'm embarrassingly new at Python, so please forgive my probably simple mistakes.<br>
>><br>
>> So I called readlines() on a file, and I'm wondering how I can check the equality of a specific line with a raw_input set variable as a condition. For example,<br>
>>readlines result must be put somewhere<br>
>> file = open('filename.txt,' 'r')<br>
>> file.readlines()<br>
>> variable_name = raw_input()<br>
>> if file[2] == variable_name:<br>
>>       #whatever<br>
>><br>
>> This approach hasn't worked so far, does anyone have any tips? Thanks so much!!<br>
>><br>
>> -Tyler<br>
><br>
><br>
> You haven't stripped the newline before doing the comparison.  You also don't have to read the whole file just to compare a specific line.  I'll leave you to find out how :)<br>
><br>
> -- <br>
> My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.<br>
><br>
> Mark Lawrence<br>
><br>
> ---<br>
> This email is free from viruses and malware because avast! Antivirus protection is active.<br>
> <a href="http://www.avast.com">http://www.avast.com</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
> To unsubscribe or change subscription options:<br>
> <a href="https://mail.python.org/mailman/listinfo/tutor">https://mail.python.org/mailman/listinfo/tutor</a><br>
</p>