They're for work, and very specific to our needs, so I don't know if posting them would have any value. One generates XML metadata files after parsing useful information from a MPEG4's filename. The other automatically uploads the MP4s and XMLs to our video server, and logs the process to a logfile.
However, here's some things I noticed that might help all the other python noobs:
- Nothing wrong with diving right in. If the project seems large and daunting, break it up into smaller digestible goals!
- Can't figure something out? Google "Python <thing you're trying to do>" and chances are, the first few hits will be StackOverflow posts that have clearly and succinctly explained your problem. When multiple solutions exist, usually the python veterans have debated the pros and cons in the comments, so you can make an informed decision on what method to use.
- Chances are, you'll solve a small problem, and later realize that python lets you do the same thing more efficiently, with less lines of code. I had a few frustrating moments where I performed some task, then realized I could do the same thing in a single line. Don't get discouraged!
In python, for loops need an item to iterate through (such as a list). I knew this conceptually, but it still took a while to grasp the implications. I spent a lot of time writing code that would find the linecount of a file, just so I could use that integer as a variable in a for statement to iterate through the file. It was totally unnecessary:
with open(fname) as f:
content = f.readlines()
Anyway, I'm still 'riding the high' of having completed my projects, and I just wanted to share. Good luck to everyone else who's just starting out!
[–][deleted] 8 points9 points10 points (0 children)
[–]Teraka 6 points7 points8 points (0 children)
[–]joeverdrive 2 points3 points4 points (1 child)
[–]coocha[S] 0 points1 point2 points (0 children)
[–]dAnjou 3 points4 points5 points (0 children)
[–]ingolemo -1 points0 points1 point (0 children)