Linked Questions

0 votes
1 answer
1k views

I'm trying to parse a list of IP:ports via a command argument to variable called HOSTS, to be used in a function - read_head_block_ints. parser = argparse.ArgumentParser(description='chain info ...
Ankh2054's user avatar
  • 1,153
1 vote
1 answer
364 views

So I have a parser set up like such: parser.add_argument('-f', '--foo', metavar='foo', type=ast.literal_eval, default=[], help="Foo") And I need to let users enter multiple values if they so desire: ...
1 vote
3 answers
514 views

i need to use shell command to run python script but the args is a list the python script: #!/usr/bin/env python # -*- coding: UTF-8 -*- import sys def main(task_list): print('task_list:',...
0 votes
0 answers
439 views

I have a script that uses argsparse to modify its inputs. For the example below, it runs a series of simulations, one after the other, based on the given arguments: def main(): parser = argparse....
Alex's user avatar
  • 1,038
-1 votes
2 answers
326 views

In python I have: parser = argparse.ArgumentParser(description='RANGES') parser.add_argument('IP_Address', action='store', type=str) How can I let the user provide a single IP adresses or range or ...
john's user avatar
  • 13
-1 votes
1 answer
61 views

I want the argparse cli parameter to use "=" sign when i'm giving the list of the arguments with a space between them. For example: --repos= repo1 repo2 repo3 but when i'm giving the ...
0 votes
0 answers
42 views

What is incorrect in the following source code? from argparse import ArgumentParser class MainClass(object): __input_files_vector = [] __output_directory = None ...
260 votes
11 answers
351k views

Any simple library or function to parse a csv encoded string and turn it into an array or dictionary? All the built in csv module examples take filepaths, not strings.
0 votes
1 answer
4k views

I want quotes around "arg1" "arg2" to be considered as separate arguments not in the same list and "arg1 arg2" as separate arguments but in the same list. test.py taken from here import argparse ...
Bryn's user avatar
  • 257
0 votes
2 answers
1k views

Is there a more elegant way to pass an optional list of integers to argparse than to pass a delimited string and parse it later? I also have a positional argument. parser.add_argument('--ids', type=...
3 votes
1 answer
2k views

Assume that I am expecting a list of lists where the inner lists have different types and lengths, e. g., [[1, 2], ["foo", "bar"], [3.14, "baz", 20]] how can I parse the above list using argparse? ...
0 votes
3 answers
2k views

I am using Subprocess call to execute Insert_API from main script.Values to be inserted are stored in a list and I need to pass the list as an argument while subprocess call. It gives me error saying ...
Shikha's user avatar
  • 391
0 votes
0 answers
2k views

Based on the official pydantic-CLI docs I created the following CommandLineArguments-class from the base class "BaseModel": from pydantic import BaseModel, Field, parse_obj_as from typing ...
1 vote
1 answer
1k views

I am writing a script using python and argparse: import argparse parser = prgparse.ArgumentParser(description="do a or b") parser.add_argument("-a", "--funcA", help=&...
1 vote
0 answers
2k views

I would like to pass a list of strings as an argument to a Python script. I have a bash script bash_script.sh like: local dtype=float32 declare -a tokens tokens=("CLS", "HI") ...

15 30 50 per page
1
2 3