Question: I am a student and currently studying python. I want to make a program so I can combine the whole line in an excel into
I am a student and currently studying python. I want to make a program so I can combine the whole line in an excel into one list element. How am I suppose to do that? Currently, I can get the data from the excel into a string. How do I combine them and turn them into a list with each line as an element? How do I write this excel into a dictionary? Thank in advance. Below is my code:
import csv def getMedalStats(): fLocation="C://TEMP//" print("Assumed file location is at: ", fLocation) fName = input(" Please enter a file name with its extension (ex. XXX.txt): ") fin = open(fLocation + fName, 'r') aStr = fin.read() return aStr #********************************************************************************* def main(): eventList = getMedalStats() print(eventList)Country Record 1 Olympics 2 Salt Lake City 2002 France 3 Salt Lake City 2002 Austria 4 Salt Lake City 2002 France 5 Salt Lake City 2002 Switzerland 6 Salt Lake City 2002 Switzerland 7 Salt Lake City 2002 Germany 8 Salt Lake City 2002 United States of America Silver four-man men four-man USA 9 Salt Lake City 2002 United States of America Bronze four-man men four-man USA 2 10 Salt Lake City 2002 United States of America Gold two-man women two-woman USA 2 11 Salt Lake City 2002 Germany 12 Salt Lake City 2002 Germany 13 Salt Lake City 2002 Estonia 14 Salt Lake City 2002 Norway 15 Salt Lake City 2002 Estonia 16 Salt Lake City 2002 Norway Medal Event Silver slalom men Bronze slalom men Gold slalom mern Silver two-man men two-man Bronze two-man men two-man 2 Gold four-man men four-man 2 Athlete Sebastien AMIEZ Benjamin RAICH Jean-Pierre VIDAL Silver two-man women two-woman Bronze two-man women two-woman 2 Gold 15km men Silver 15km men Bronze 15km me Bronze 50km Andrus VEERPALU Frode ESTIL Jaak MAE Odd-Bjoern HJELMESET
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

