Created
November 16, 2012 18:08
-
-
Save jasonsperske/4089505 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list_of_lists=[] | |
category=0 | |
list_of_lists.append([]) | |
f = open("list.txt",'r') | |
for line in f.readlines(): | |
item = line.strip('\n') # no white spaces in the list | |
if len(item) > 0: | |
#add to current category | |
list_of_lists[category].append(item) | |
else: | |
#add new category | |
list_of_lists.append([]) | |
category = category + 1 | |
f.close() | |
print(list_of_lists) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment