Identity is not the same things as equality in Python

This commit is contained in:
cclauss 2019-06-22 20:53:28 +02:00
parent d6f40dfcdf
commit 7f34998dab
3 changed files with 3 additions and 3 deletions

View File

@ -54,7 +54,7 @@ def main():
line = line.strip()
items.append(line)
# When no more items, blank line or new header
elif line is '\n':
elif line == '\n':
# when we meet the next header, we should stop adding new item to the list.
for item in sorted(items, key=lambda x: regex.findall(x.upper())[len(regex.findall(x.upper()))-1]):
# write the ordered list to the temporary file.

View File

@ -54,7 +54,7 @@ def main():
line = line.strip()
items.append(line)
# When no more items, blank line or new header
elif line is '\n':
elif line == '\n':
# when we meet the next header, we should stop adding new item to the list.
for item in sorted(items, key=lambda x: regex.findall(x.upper())[len(regex.findall(x.upper()))-1]):
# write the ordered list to the temporary file.

View File

@ -54,7 +54,7 @@ def main():
line = line.strip()
items.append(line)
# When no more items, blank line or new header
elif line is '\n':
elif line == '\n':
# when we meet the next header, we should stop adding new item to the list.
for item in sorted(items, key=lambda x: regex.findall(x.upper())[len(regex.findall(x.upper()))-1]):
# write the ordered list to the temporary file.