[New-bugs-announce] [issue25231] Argparse module and escape sequence (special symbols) in argument value

Ondřej Profant report at bugs.python.org
Fri Sep 25 13:53:57 CEST 2015


New submission from Ondřej Profant:

I am trying to put tabulator '\t' into argument value. 

Minimal working example:

<code>
#!/usr/bin/env python3

import argparse

def main():
        parser = argparse.ArgumentParser()
        parser.add_argument('-f', '--foo', default="test", help="test")
        args = parser.parse_args()

        print("Argument foo is: " + args.foo + "|")
        print("Tabulator usage: |\t|")

if __name__ == '__main__':
        main()
</code>

My attempts:
./test.py -f \t
./test.py -f '\t'
./test.py -f "\t"

But this is not functional. Is there way to put special characters into argument?
~

----------
components: Library (Lib)
messages: 251580
nosy: Ondřej Profant
priority: normal
severity: normal
status: open
title: Argparse module and escape sequence (special symbols) in argument value
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25231>
_______________________________________


More information about the New-bugs-announce mailing list