Skip to content

Instantly share code, notes, and snippets.

@donhamiltoniii
Created May 4, 2018 01:19

Revisions

  1. donhamiltoniii created this gist May 4, 2018.
    54 changes: 54 additions & 0 deletions rattleprofileparser.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    #! usr/bin/env python3

    #This script will compile lifetime rattle profiles of long term snakes and spit out their ID and a list of segment values, newest to oldest

    #load required modules
    import sys
    import os
    import re
    import argparse


    def get_args():
    #create an ArgumentParser object ('parser')
    parser = argparse.ArgumentParser()

    #add required arguments
    parser.add_argunent("txt", help="name of the txt, tab delimited, data file")

    #parse the arguments
    return parser.parse_args()



    def parse_file():
    #open the txt file
    # make the reference to the file a string
    complete = open('whatever-file-you-are-parsing.txt', 'r')

    print(complete)




    def build_lists():
    # add anything in here so it closes the function
    variableToMakeCompilerHappy = 'Pike Mouth help you.'





    def main():
    # take out complete
    parse_file()

    main()


    # I made a file named 'whatever-file-you-are-parsing.txt'
    # in the project directory
    #
    # Here's the output I get when I run that:
    #
    # `<open file 'whatever-file-you-are-parsing.txt', mode 'r' at 0x106ff24b0>`