且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python是否等同于Perl BEGIN {}块?

更新时间:2023-02-12 21:46:06

3月12日下午6:19,Alex< alex.pul .. 。@ gmail.comwrote:
On Mar 12, 6:19 pm, Alex <alex.pul...@gmail.comwrote:

大家好,


主题说几乎所有,我非常感谢答案。我b $ b试图搜索各个论坛和小组,但没有找到任何

具体答案......


谢谢,

Alex。
Hi all,

The subject says pretty much all, i would very appreciate an answer. I
tried to search the various forums and groups, but didn''t find any
specific answer...

Thanks,
Alex.



不是不是真的。


虽然有很多其他方法可以构建Python程序

,几乎感觉不到它。


- Paddy。

No not really.

There are lots of other ways to structure a Python program though
which makes its omission hardly felt.

- Paddy.


主题说几乎所有,


鉴于我对BEGIN块[1]的理解,这就是蟒蛇自动生成的方式:


bash
The subject says pretty much all,

Given what I understand about the BEGIN block[1], this is how
Python works automatically:

bash


cat a.py

打印''a1''

导入b

打印''a2' '


bash
cat a.py
print ''a1''
import b
print ''a2''

bash