- source
import sys
sa = sys.argv[1]
l = sa.split("\\n") # not \n
print(l)
if len(l) >= 2:
ret = float(l[len(l)-1])
else:
ret = float(sa)
print(ret)
- execution
# python3 test.py "3.1"
['3.1']
3.1
# python3 test.py "3.1\n3.2"
['3.1', '3.2']
3.2