by jliechti1 · 13y ago · 0 comments
Just knowing this setup below can let you do some really power automation of manual tasks and can save you a lot of time.
Example template in Python:
import csv
with open('mydata.csv', 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in reader:
# Data manipulation hereBut this suggests a different way of teaching intro programming, one that is more tool-based than concept-based, a way that's about searching for the existence of a tool and then finding and reading its documentation or examples so that one can use it in a simple, encapsulating control program. If you don't know about the existence of imagemagick, are you going to think you can loop through all the images in a folder and resize them, or extract a subimage from them, or something else, without having to write a ton of code? Maybe not, but you might search for a command line program to do the hard part and discover the tool, or it might have been part of an intro programming course focused on "look at all the neat things general computers can do to save you time if you have this problem". Same thing with Python's csv module, which someone who has used Python for over a year in a CS class may not have even known was there all along. There are lots of powerful one-liners and small code chunks that deserve a lot of respect since they can save so much time.