Discuss / Python / day13-2022/6/2

day13-2022/6/2

Topic source

Promethues

#1 Created at ... [Delete] [Delete and Lock User]

# -*- coding: utf-8 -*-

'a test module'

__author__ = 'angel'

import sys

def test():

    args = sys.argv

    if 1 == len(args):

        print('hello world!')

    elif 2 == len(args):

        print(f'hello {args[1]}')

    else:

        print('args too many')

# print(__name__) # 输出__main__

if __name__ =='__main__':  #判断被其他模块调用时,不进行test

    test()

import 模块 #居然可以汉字

模块.test()


  • 1

Reply