저는 파이썬을 사용하여 CSV를 만들려고합니다. 각 행에서 첫 번째 셀은 질문을 한 사람이되고 두 번째 셀은 대답 한 사람이되고 세 번째 셀은 대답이 게시 된 시간이됩니다. 난 그냥리스트의 각 요소는 셀이 목록을 의미하는 것은 다음과 같습니다이다 간단한 목록을 만드는거야 :CSV에 쓸 때 간격이 꺼지는 이유는 무엇입니까?
Jan Janet 3/4/05
Jason John 3/6/05
...
을하지만 내 출력 셀 당 하나 개의 문자가 아니라 한 단어가 있습니다.
을 Heres의 내 코드 :
import csv
import collections
from collections import defaultdict
edgelist = []
csv.field_size_limit(1600000)
f = open('/Users/samuelfinegold/Documents/harvard/edXresearch/snaCreationFiles/time_series/time_series.csv','rU')
reader = csv.DictReader(f, delimiter=',')
if line['types'] == 'Question':
#print 'T'
source = line['author_id']
else:
edgelist.append(source + " " + line['author_id'] + " " + line['time'])
with open("/Users/samuelfinegold/documents/harvard/edxresearch/snacreationfiles/time_series/connections_times_series_ex.csv", "w") as the_file:
csv.register_dialect("custom", delimiter=",", skipinitialspace=True)
writer = csv.writer(the_file, dialect="custom")
writer.writerows(edgelist)
the_file.close()
f.close()
어떻게 세포보다는 편지 당 단어로 CSV를받을 수 있나요?
그렇게하려고합니다 지금 – goldisfine