-
Notifications
You must be signed in to change notification settings - Fork 12
IOError: File not open for reading
Shuang0420 edited this page May 29, 2016
·
1 revision
# get input file, text format inp = sys.argv[1] input = open(inp, 'r') output = open('output.seq', 'w') # read file and separate words for line in input.readlines(): line=line.strip('\n') seg_list = jieba.cut(line) output.write(' '.join(seg_list) + '\n') # initialize the model model = Word2Vec(LineSentence(output), size=100, window=3, min_count=5,workers=multiprocessing.cpu_count())
IOError: File not open for reading
打开模式仍然为写,没法读
# before initializing the model output.close() output= open('output.seq', 'r')
[[TOC]]