An initiative at work requires me to analyze a large spreadsheet of data. One of the columns contains a csv-separated list of bugs that I need to take a look at. Normally, this would be a painful job of copying each defect and pasting it in the browser repeatedly. When hundreds of rows needed analysis, each involving multiple defect IDs, I switched to python to ease my pain.
I knew where to look because of this cute easter-egg in python:
The help text for this module led me to the library, c:\python33\lib\antigravity.py in my case. The webbrowser module imported here showed how easy it is to launch a browser tab by passing a URL from python:
This was all I need for my job as well. I wrote a 10 line script that basically:
- asked the user for input (in my case a comma separated list of defects),
- converted the input to a list and stripped unneeded whitespace,
- iterated through this list and appended the defect ID to the base URL, and
- called the webbrowser module to open the tabs.
bugs=input('Paste the list of bugs:\n')
for i,x in enumerate(buglist):
for i in buglist:
And that's it! A half-dozen tabs open immediately and I can move on to analyzing them. Python has proved to be a boon in my daily job for quick and dirty scripts like this.