Don't argparse read unicode from commandline?

前端 未结 2 546
执念已碎
执念已碎 2021-02-03 10:15

Running Python 2.7

When executing:

$ python client.py get_emails -a \"åäö\"

I get:

usage: client.py get_emails [-h] [-a         


        
2条回答
  •  心在旅途
    2021-02-03 10:59

    You can try

    type=lambda s: unicode(s, 'utf8')
    

    instead of

    type=unicode
    

    Without encoding argument unicode() defaults to ascii.

提交回复
热议问题