1

I have a function like this -

def f(arg)
  print(arg)

trying to pass an argument with Python Fire like this -

f hello there

output -

hello
das-g
  • 9,718
  • 4
  • 38
  • 80
Duke79
  • 827
  • 1
  • 10
  • 21

1 Answers1

2

It worked after enclosing the input within escaped quotes -

f \"hello there\"

output -

hello there
Duke79
  • 827
  • 1
  • 10
  • 21
  • 4
    That is because without quotes it will treat `hello` as first argument and `there` as second argument. with quotes it binds together to form a single argument `hello there` – mad_ Dec 07 '18 at 14:20
  • 1
    This *still* has two arguments: the escaped quotes are just regular characters, so they don't escape the space between `hello` and `there`. If this produces the output you claim, there's some context you left out of the original question. – chepner Dec 07 '18 at 14:23