test.py:
import argparse
desc = "【Welcome to get there!】"
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('--lr', type=float, default=0.0001, help='The learning rate')
parser.add_argument('--tc', type=int, default=10, help='The count of training')
args = parser.parse_args()
print("lr = ",args.lr)
print("tc = ",args.tc)
demo.py:
#参数可以被导入
from test import *
print("*lr* = ",args.lr)
print("*tc* = ",args.tc)