Skip to content

Instantly share code, notes, and snippets.

@Elfsong
Last active January 26, 2019 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Elfsong/2facf0f3821463948be3a883929b78f8 to your computer and use it in GitHub Desktop.
Save Elfsong/2facf0f3821463948be3a883929b78f8 to your computer and use it in GitHub Desktop.
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