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: li
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
Dave, I gave an example, again, and make no deep claims so your comments may be
valid, without any argument.
I mentioned CSV and a related family such as TSV as they were a common and
simple data format that has long been used. There are oodles of others and yes,
these days many people can read
On 26/11/2023 18.50, Dieter Maurer wrote:
Piergiorgio Sartor wrote at 2023-11-25 22:15 +0100:
...
Apparently, the "with" context manager is not usable
in classes, at least not with __init__() & co.
You can use `with` in classes -- with any context manager.
However, you would usually not use `w
I have a north viriginia ec2 linux instance and a windows machine at my home,
how do I connec tthem?
import paramiko
import time
def run_scripts():
# Set your local machine's SSH details
local_machine_ip = ' '
username = 'justk'
private_key_path = 'C:/Users/justk/.ssh/kashish'
Read the Fine context manager documentation.
What “with with_expression as var” does is effectively:
ob = with_expression
var = ob.__enter__()
And then at the end of the with, does a
ob.__exit__()
(With some parameters to __exit__, that could just be None, None, None for the
simplest case).
N
Read the Fine context manager documentation.
What “with with_expression as var” does is effectively:
ob = with_expression
var = ob.__enter__()
And then at the end of the with, does a
ob.__exit__()
(With some parameters to __exit__, that could just be None, None, None for the
simplest case).
N
> I *must* do:
>
> with device_open() as device:
>device.do_something()
>
> Nevertheless, I _need_ to have a class
> where the device is opened in the __init__()
> and used in some methods.
>
> Any ideas?
Perhaps take a look at contextlib.ExitStack and see if you can do something
with it.
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 = argparse.Argume
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 Wi
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 w
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 bo
12 matches
Mail list logo