4 ms·
From a practical standpoint, I really wish everyone was taught enough programming to know how to automate basic manipulation of text data. I see way too many pe
by jliechti1 13y ago
From a practical standpoint, I really wish everyone was taught enough programming to know how to automate basic manipulation of text data. I see way too many people editing long lists of data by hand, when there are much better ways to go about it (even Excel works great for this kind of stuff).
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 here
- wry 13y agoI agree, basic scripting and automation would be more useful to the general population. Rather than just learning to code, I think that many people people could benefit from learning how to use technology first, include some theory and logic courses that lead into CS.
- Jach 13y agoI have more or less the same viewpoint. There are big gains if everyone understood how much time code loops can save, and if they started to see the areas of their lives where a manual task could be cast into an automatic task without much work. But 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.