Print function not working

Peter Otten __peter__ at web.de
Thu Aug 11 13:35:47 EDT 2016


Atri Mahapatra 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?

Hard to tell. Either there slipped an extra space into the string literal in

> if ( __name__ == " __main__"): #{

or the interpreter got really annoyed about you trying to write C/Java/PHP 
rather than proper Python...




More information about the Python-list mailing list