No Hello World | import __hello__ does not work anymore | #python #programming #coding #shorts

No Hello World | import __hello__ does not work anymore | #python #programming #coding #shorts

BOOTLOGICS

54 года назад

191 Просмотров

No Hello World | import __hello__ does not work anymore | #python #programming #coding #shorts

The easter egg in the Python __hello__ module was fixed in Python 3.11, so importing __hello__ no longer prints "Hello World!" by default. To get the same effect, you now need to call the module's main method:

import __hello__
__hello__.main()

If you want to print "Hello World!" without calling the main method, you can do so by importing the module and then accessing the _hello attribute:
import __hello__
print(__hello__._hello)

__hello__ is a frozen module intended as a test case for frozen module support. Its source code is automatically generated by the Python freeze utility
Ссылки и html тэги не поддерживаются


Комментарии: