Last active
January 26, 2019 04:56
-
-
Save Elfsong/2facf0f3821463948be3a883929b78f8 to your computer and use it in GitHub Desktop.
Excel writer #spreadsheet #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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