Skip to content

Instantly share code, notes, and snippets.

@Elfsong Elfsong/excel_writer.py
Last active Jan 26, 2019

Embed
What would you like to do?
Excel writer #spreadsheet #python
import xlwt
import random
import demo_night
ROOT_PATH = r"C:\Users\t-midu\PycharmProjects\Scenario_detecter"
RESOURCE_PATH = os.path.join(ROOT_PATH, "resource")
file_path = os.path.join(RESOURCE_PATH, "stories.json.txt")
# Crating a new sheet
workbook = xlwt.Workbook(encoding='utf-8')
worksheet = workbook.add_sheet('sheet1')
# Setting titles
worksheet.write(0, 0, label='Sentence')
worksheet.write(0, 1, label='Type suggestion')
worksheet.write(0, 2, label='Trigger')
for sentence_count in range(sentence_count):
worksheet.write(sentence_count, 0, sentence)
worksheet.write(sentence_count, 1, " ".join(type_list))
worksheet.write(sentence_count, 2, " ".join(trigger_list))
workbook.save('sentence_class_new.xls')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.