cara membentuk daftar dari file dalam python
myFile= open( "SomeFile.txt", "r" )
for x in myFile:
print x
myFile.close()
Clever Crab
myFile= open( "SomeFile.txt", "r" )
for x in myFile:
print x
myFile.close()
list_of_lists = []
i=0
List=[""]
for Line in inFile:
List[i]=Line.split(",")
i+=1
print List
my_list = [line.split(',') for line in open("filename.txt")]
l = []
for line in in_file:
l.append(line.rstrip().split(','))
a_file = open("sample.txt", "r")
for line in a_file:
List = open("filename.txt").readlines()
l = []
for line in in_file:
l.append(line.split(','))