mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
[Patch #1005491 ] use __name__ == '__main__' in scripts
This commit is contained in:
parent
6c542b731c
commit
e236b38731
34 changed files with 257 additions and 200 deletions
|
@ -13,13 +13,17 @@ def lll(dirname):
|
|||
full = os.path.join(dirname, name)
|
||||
if os.path.islink(full):
|
||||
print name, '->', os.readlink(full)
|
||||
|
||||
args = sys.argv[1:]
|
||||
if not args: args = [os.curdir]
|
||||
first = 1
|
||||
for arg in args:
|
||||
if len(args) > 1:
|
||||
if not first: print
|
||||
first = 0
|
||||
print arg + ':'
|
||||
def main():
|
||||
args = sys.argv[1:]
|
||||
if not args: args = [os.curdir]
|
||||
first = 1
|
||||
for arg in args:
|
||||
if len(args) > 1:
|
||||
if not first: print
|
||||
first = 0
|
||||
print arg + ':'
|
||||
lll(arg)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue