Reading them into a list is trivially done with readlines()
:
f = open('your-file.dat')
yourList = f.readlines()
If you need the newlines stripped out you can use ars' method, or do:
yourList = [line.rstrip('
') for line in f]
If you want a dictionary with keys from 1 to the length of the list, the first way that comes to mind is to make the list as above and then do:
yourDict = dict(zip(xrange(1, len(yourList)+1), yourList))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…