EDIT: I know there were previous similar questions. Except that it was asked by people who already know Python. I did try the duplicated answer you suggested and it is not working (nothing display in console when I ran it with command line argument). That solution seems to ignore input value via cmd line arg. I could do the job easily in other languages. But for this exercise, I need a Python script. Please help me to write a script ready for use. Sorry if this sounds like a careless request. I do know programming, the trouble here is that I don't know anything about Python.
This is to be used in a streaming exercise with the Hive language (part of Hadoop). Here is the specs:
- The script take the value from the command line argument and return the result to standard output
- Add thousand separator when the value is compatible with numerical value, otherwise re-output the same input value unchanged.
Example:
$ InsertThousandSeparator.py 386
386
$ InsertThousandSeparator.py 1234567
1,234,567
$ InsertThousandSeparator.py 123ABC
123ABC
$ InsertThousandSeparator.py 123ABC456
123ABC456
$ InsertThousandSeparator.py Hello
Hello
$ InsertThousandSeparator.py 12345.67
12,345.67
The last example with decimal, if it's too complicate to code, this could be skipped.
Thank you very much in advance for any help.