SyntaxFix
Write A Post
Hire A Developer
Questions
The check has to be like this:
if num == line.split()[0]:
If file.txt has a layout like this:
1 foo 20 bar 30 20
We split up "1 foo" into ['1', 'foo'] and just use the first item, which is the number.
"1 foo"
['1', 'foo']