Python Try Except Direct Error To Different File
numbers = [1,2,3, '4', '5', 6, 7]
for number in numbers:
print number * 2
I want to double the number as many as I could and forget those string
type numbers.
I want to have two files separately, one storing the result one storing
the error. How to combine the linux shell std Input/Output/Error feature
to implement what I want. I assume the final shell command should look
like this:
python script.py >success.file 2>fail.file
I don't know how to implement that in python, try except?
No comments:
Post a Comment