Create CLI for python using Fire
Fire is a really simple library to build CLI. Install it ( you can use conda as well):
pip install fire
And then use it in your app, for example here:
import pandas as pd
import fire
def to_csv(fileName,sheet,outfile):
= pd.read_excel(fileName,sheet=sheet)
df for c in df.columns:
= df[c].astype(str)
df[c]= df[c].str.replace(r"/\n\r|\n|\r/g",'')
df[c] = df[c].str.strip()
df[c] =False,header=False)
df.to_csv(outfile,index
if __name__ == '__main__':
fire.Fire(to_csv)