84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
我在服务器上的得到一些数据,然后用shell截取并整理,每3个分成一组。然后是我想把这若干组数据每组当作一组参数传入一个python的函数,应该怎样做?
欢迎选择我的课程,让我们一起见证您的进步~~
You can use the argparse module:
# coding: utf-8 import argparse def bar(*args, **kwargs): print 'command parameter:', args, kwargs if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("port", help="listen to the server port.", type=int) args = parser.parse_args() parser = argparse.ArgumentParser() bar(args.port)
If you use bash to process data, you can also use python to receive and process it. This way you don’t have to pass the data to python through bash, and python is also very simple.
I feel like you said this amount is huge? Consider pipe or save it as a file and read it with Python
You can use the argparse module:
If you use bash to process data, you can also use python to receive and process it. This way you don’t have to pass the data to python through bash, and python is also very simple.
I feel like you said this amount is huge? Consider pipe or save it as a file and read it with Python