Python : writing to a file
Dave Angel
davea at davea.name
Sun Jan 11 03:47:42 EST 2015
You accidentally did a Reply instead of a Reply-List. So the email came
to me and not to the list. if your mail program doesn't support
reply-list, do a reply-all and remove the personal addresses. The list
is what's important here.
On 01/11/2015 12:20 AM, Ganesh Pal wrote:
> On Sat, Jan 10, 2015 at 9:07 PM, Dave Angel <davea at davea.name> wrote:
>
<snip>
>
> I did execute the program multiple times, It appeared that it was not
> working because I was trying to view the contents of the file using
> cat commad and cat didn't display the data.
>
> case (a) output with cat:
>
> node- 1# file test_2.txt
> test_2.txt: ASCII text, with no line terminators
>
> node-1# cat test_2.txt
>
You chopped off the output there. It probably looked like this:
node-1# cat test_2.txt
Sundaynode-1#
Your output is there, right before the prompt. Since you neglected the
newline in your code, that's what you'd expect, wouldn't you?
Incidentally, in most systems that prompt would mean you're running as
root. Bad idea, especially when you're learning to program.
--
DaveA
More information about the Python-list
mailing list