Re: argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Yeah, I have been hearing that people are having troubles converting, but I have only used argparse - got lucky there I guess. I am thinking just making the function which spits the class out. Maybe not very optimised solution, but simple. Argument parsing in my case is very far from being a

Re: argparse argument post-processing

2023-11-27 Thread Mats Wichmann via Python-list
On 11/27/23 13:21, Dom Grigonis wrote: Thank you, exactly what I was looking for! One more question following this. Is there a way to have a customisable action? I.e. What if I want to join with space in one case and with coma in another. Is there a way to reuse the same action class? I've

Re: argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Thank you, exactly what I was looking for! One more question following this. Is there a way to have a customisable action? I.e. What if I want to join with space in one case and with coma in another. Is there a way to reuse the same action class? Regards, DG > On 27 Nov 2023, at 21:55, Mats

Re: argparse argument post-processing

2023-11-27 Thread Mats Wichmann via Python-list
On 11/27/23 04:29, Dom Grigonis via Python-list wrote: Hi all, I have a situation, maybe someone can give some insight. Say I want to have input which is comma separated array (e.g. paths='path1,path2,path3') and convert it to the desired output - list: import argparse parser =

Re: argparse argument post-processing

2023-11-27 Thread Chris Angelico via Python-list
On Mon, 27 Nov 2023 at 22:31, Dom Grigonis via Python-list wrote: > > Hi all, > > I have a situation, maybe someone can give some insight. > > Say I want to have input which is comma separated array (e.g. > paths='path1,path2,path3') and convert it to the desired output - list: This is a single

argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Hi all, I have a situation, maybe someone can give some insight. Say I want to have input which is comma separated array (e.g. paths='path1,path2,path3') and convert it to the desired output - list: import argparse parser = argparse.ArgumentParser() parser.add_argument('paths', type=lambda x: