argparse argument input as raw text or file

Viewed 19

Is there easy to get input using argparse whether it is raw text or file name based on prefix char, e.g.

python program.py -data @filename.txt
python program.py -data 'raw text'

so the above programs should be equivalent if content of filename.txt is raw text.

0 Answers
Related