handle blank lines in list.txt more gracefully

This commit is contained in:
Ritiek Malhotra
2016-10-21 12:52:52 +05:30
committed by GitHub
parent 1f46d7b7df
commit 2448894d9c

View File

@@ -74,12 +74,12 @@ def Main():
x = 0 x = 0
y = 0 y = 0
for songie in lines: for songie in lines:
if not songie == '\n' or not songie == '': if not len(songie) == 0:
x = x + 1 x = x + 1
print 'Total songs in list = ' + str(x) + ' songs' print 'Total songs in list = ' + str(x) + ' songs'
for songie in lines: for songie in lines:
try: try:
if not songie == '\n' or not songie == '': if not len(songie) == 0:
if (len(songie) == 22 and songie.replace(" ", "%20") == songie) or (songie.find('spotify') > -1): if (len(songie) == 22 and songie.replace(" ", "%20") == songie) or (songie.find('spotify') > -1):
#song = songie.replace(songie[-1:], "") #song = songie.replace(songie[-1:], "")
song = songie song = songie