Join Barron Stone for an in-depth discussion in this video Reading CSV data, part of Code Clinic: Python.
- In this video,…I'll explain how the "insert_csv" function…in my "csv_tables" Python script works.…This function acts as the main function for the script…and handles reading in the csv files…and inserting the generated html tables…into the correct location on the web page.…The first thing you may notice…when you open the "csv_tables" Python script,…is that it's a fairly short program.…It's only 66 lines long.…At the top of the script…I import the Python "csv" module,…which is included with the standard Python distribution.…
And just below that…you'll see that I specify two constants…for the relative paths to the html file…and for the csv files to insert.…At the very bottom of the script,…there's an "if" statement which detects…if this script is being run as the main program,…and if so, it executes the "insert_csv" function…by passing in those constants for the…html and csv file locations.…Now, I chose to hardcode these values…into the script for simplicity, because this script…is intended to perform a very specific task…
Barron introduce challenges and provides an overview of his solutions in Python. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Visit other courses in the series to see how to solve the exact same challenges in languages like C#, C++, Java, PHP, and Ruby.
Skill Level Intermediate
Problem One: Exploring Lake Pend Oreille
Problem Two: Image Analysis
Problem Three: Eight Queens
Problem Four: Accessing Peripherals
Problem Five: Recursion and Directories
Problem Six: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.