Last active
April 17, 2020 20:45
-
-
Save mudongliang/a68280f2f19ca96311271f8839402cc7 to your computer and use it in GitHub Desktop.
Template for my python Script
This file contains 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 | |
""" | |
A simple python script template. | |
""" | |
from __future__ import print_function | |
import os | |
import sys | |
import argparse | |
def main(input_file): | |
with open(input_file, "r") as in_fd: | |
for line in in_fd: | |
print(line) | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-i', '--in_file', help='provide the path of input data file', type=str) | |
args = parser.parse_args() | |
if not args.in_file: | |
parser.error("Please provide argument for input data file") | |
main(args.in_file) | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment