Print function not working

Chris Angelico rosuav at gmail.com
Thu Aug 11 13:18:01 EDT 2016


On Fri, Aug 12, 2016 at 3:03 AM, Atri Mahapatra
<atri.mahapatra at gmail.com> wrote:
> I have installed IDLE 3.5.1 and wrote the following  to check if print is working. When it runs, I do not see anything is printed:
>
> class Base: #{
>     def __init__( self ): #{
>         print("Hello, world: \n\n");
>
>         #}
>
>     #}
>
>
> if ( __name__ == " __main__"): #{
>     root = Base();
> #}
>
> Can anyone please point out the reason?
>
> Thanks,
> Atri

Is name equal to main? That is, are you running this code as a top-level script?

Also: You do not need to write Python code as if it were C or Java.
All that extra punctuation is just putting unnecessary stress on the
world's punctuation mines, which are already overworked. :)

ChrisA



More information about the Python-list mailing list