Creating a .csv file
Use your script to put data into a .csv file that you can open with Excel. Just the basics in this simple example.
Size 1 kB - File type text/python-sourceFile contents
#
#Comp 171 Standard Python Script Header
#Assignment name: Write materials to a .csv file the works with Excel
#LUC id and Name whonig@luc.edu William Honig
#Date 19 Feb 2012
#
#Simple example of script that writes a text file suitable to open in Excel
#
#Questions: Want to do more? See the documents in the Standard Library
# 13.1. csv — CSV File Reading and Writing
#
#
import csv
def writeCsv():
newCsv = open( "myResults.csv", "a", newline="" )
csvWriter = csv.writer( newCsv )
#csvWriter = csv.writer( newCsv, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL )
csvWriter.writerow( ["one", "two", "three", "two"*3] )
csvWriter.writerow( ["Next Line", 23*5, 12/5, "here we go "*3] )
newCsv.close()
Click here to get the file