Can you print the output of a program on an text external document | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you print the output of a program on an text external document

2nd Feb 2017, 9:41 AM
Llewellyn Kay
Llewellyn Kay - avatar
4 Answers
+ 2
@Christian Klen: This will work on linux and unix-like system, but on windows I'm not sure :P But there's probably another way to do it ;)
2nd Feb 2017, 12:05 PM
visph
visph - avatar
+ 1
Hi. Yes, it's possible. You just have to redirect the output for a file using the '>' operator, like this: python your_program.py > your_file.txt The '>' operator redirect the output of your python program (your_program.py) to the file (your_file.txt). I hope it helps.
2nd Feb 2017, 9:55 AM
Cristian Klen
Cristian Klen - avatar
+ 1
Yeah? Ok: I believe you... I prefer than run windows :P
2nd Feb 2017, 8:55 PM
visph
visph - avatar
0
@visph, It will work properly on Windows as well. Give it a try.
2nd Feb 2017, 4:45 PM
Cristian Klen
Cristian Klen - avatar