Created
November 12, 2016 02:08
-
-
Save calebrob6/e40a9ecb666f2889c7933eae78b549b1 to your computer and use it in GitHub Desktop.
Python template for vim, for use with https://github.com/aperezdc/vim-template/tree/master/templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# | |
# Copyright © %YEAR% %USER% <%MAIL%> | |
# | |
# Distributed under terms of the %LICENSE% license. | |
import sys | |
import time | |
def loadCSV(fn,header=False,DELIM="|"): | |
f = open(fn, "r") | |
headerLine = None | |
if header: | |
headerLine = f.read().strip().split(DELIM) | |
lines = map(str.strip, f.read().strip().split("\n")) | |
f.close() | |
data = [] | |
for line in lines: | |
if line!="": | |
parts = line.split(DELIM) | |
if headerLine!=None: | |
assert len(parts) == len(headerLine) | |
data.append(parts) | |
return data | |
def main(): | |
print "Starting" | |
startTime = float(time.time()) | |
%HERE% | |
print "Finished in %0.4f seconds" % (time.time() - startTime) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment