| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,9 +17,8 @@ msgstr "" | |||
| 17 | 17 | "Generated-By: Babel 2.17.0\n" | |
| 18 | 18 | ||
| 19 | 19 | #: ../../library/getopt.rst:2 | |
| 20 | - #, fuzzy | ||
| 21 | 20 | msgid ":mod:`!getopt` --- C-style parser for command line options" | |
| 22 | - msgstr ":mod:`getopt` --- 명령 줄 옵션용 C 스타일 구문 분석기" | ||
| 21 | + msgstr ":mod:`!getopt` --- 명령 줄 옵션용 C 스타일 구문 분석기" | ||
| 23 | 22 | ||
| 24 | 23 | #: ../../library/getopt.rst:8 | |
| 25 | 24 | msgid "**Source code:** :source:`Lib/getopt.py`" | |
@@ -35,7 +34,6 @@ msgid "" | |||
| 35 | 34 | msgstr "" | |
| 36 | 35 | ||
| 37 | 36 | #: ../../library/getopt.rst:20 | |
| 38 | - #, fuzzy | ||
| 39 | 37 | msgid "" | |
| 40 | 38 | "This module helps scripts to parse the command line arguments in " | |
| 41 | 39 | "``sys.argv``. It supports the same conventions as the Unix " | |
@@ -45,7 +43,7 @@ msgid "" | |||
| 45 | 43 | "argument." | |
| 46 | 44 | msgstr "" | |
| 47 | 45 | "이 모듈은 스크립트가 ``sys.argv``\\에 있는 명령 줄 인자를 구문 분석하는 데 도움이 됩니다. 유닉스 " | |
| 48 | - ":c:func:`getopt` 함수와 같은 규칙을 지원합니다 ('``-``' 와 '``--``' 형식의 인자의 특수한 의미를 " | ||
| 46 | + ":c:func:`!getopt` 함수와 같은 규칙을 지원합니다 ('``-``' 와 '``--``' 형식의 인자의 특수한 의미를 " | ||
| 49 | 47 | "포함합니다). 선택적인 세 번째 인자를 통해 GNU 소프트웨어가 지원하는 것과 유사한 긴 옵션을 사용할 수 있습니다." | |
| 50 | 48 | ||
| 51 | 49 | #: ../../library/getopt.rst:26 | |
@@ -63,7 +61,6 @@ msgid "This module provides two functions and an exception:" | |||
| 63 | 61 | msgstr "이 모듈은 두 가지 함수와 예외를 제공합니다:" | |
| 64 | 62 | ||
| 65 | 63 | #: ../../library/getopt.rst:39 | |
| 66 | - #, fuzzy | ||
| 67 | 64 | msgid "" | |
| 68 | 65 | "Parses command line options and parameter list. *args* is the argument " | |
| 69 | 66 | "list to be parsed, without the leading reference to the running program. " | |
@@ -75,17 +72,16 @@ msgstr "" | |||
| 75 | 72 | "명령 줄 옵션과 매개 변수 목록을 구문 분석합니다. *args*\\는 실행 중인 프로그램에 대한 앞머리 참조를 포함하지 않는, 구문" | |
| 76 | 73 | " 분석할 인자 리스트입니다. 일반적으로, 이는 ``sys.argv[1:]``\\를 의미합니다. *shortopts*\\는 스크립트가" | |
| 77 | 74 | " 인식하고자 하는 옵션 문자의 문자열이며, 인자를 요구하는 옵션은 뒤에 콜론(``':'``; 즉, 유닉스 " | |
| 78 | - ":c:func:`getopt`\\가 사용하는 것과 같은 형식)이 필요합니다." | ||
| 75 | + ":c:func:`!getopt`\\가 사용하는 것과 같은 형식)이 필요합니다." | ||
| 79 | 76 | ||
| 80 | 77 | #: ../../library/getopt.rst:47 | |
| 81 | - #, fuzzy | ||
| 82 | 78 | msgid "" | |
| 83 | 79 | "Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " | |
| 84 | 80 | "arguments are considered also non-options. This is similar to the way " | |
| 85 | 81 | "non-GNU Unix systems work." | |
| 86 | 82 | msgstr "" | |
| 87 | - "GNU :c:func:`getopt`\\와는 달리, 옵션이 아닌 인자 다음에 오는 모든 인자는 옵션이 아닌 것으로 간주합니다. 이는" | ||
| 88 | - " 비 GNU 유닉스 시스템이 작동하는 방식과 비슷합니다." | ||
| 83 | + "GNU :c:func:`!getopt`\\와는 달리, 옵션이 아닌 인자 다음에 오는 모든 인자는 옵션이 아닌 것으로 간주합니다. " | ||
| 84 | + "이는 비 GNU 유닉스 시스템이 작동하는 방식과 비슷합니다." | ||
| 89 | 85 | ||
| 90 | 86 | #: ../../library/getopt.rst:51 | |
| 91 | 87 | msgid "" | |
@@ -138,17 +134,15 @@ msgstr "" | |||
| 138 | 134 | " 중지합니다." | |
| 139 | 135 | ||
| 140 | 136 | #: ../../library/getopt.rst:80 | |
| 141 | - #, fuzzy | ||
| 142 | 137 | msgid "" | |
| 143 | 138 | "If the first character of the option string is ``'+'``, or if the " | |
| 144 | 139 | "environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " | |
| 145 | 140 | "processing stops as soon as a non-option argument is encountered." | |
| 146 | 141 | msgstr "" | |
| 147 | - "옵션 문자열의 첫 번째 문자가 ``'+'`` 이거나, 환경 변수 :envvar:`POSIXLY_CORRECT`\\가 설정되면, " | ||
| 142 | + "옵션 문자열의 첫 번째 문자가 ``'+'`` 이거나, 환경 변수 :envvar:`!POSIXLY_CORRECT`\\가 설정되면, " | ||
| 148 | 143 | "옵션이 아닌 인자를 만나자마자 옵션 처리가 중지됩니다." | |
| 149 | 144 | ||
| 150 | 145 | #: ../../library/getopt.rst:87 | |
| 151 | - #, fuzzy | ||
| 152 | 146 | msgid "" | |
| 153 | 147 | "This is raised when an unrecognized option is found in the argument list " | |
| 154 | 148 | "or when an option requiring an argument is given none. The argument to " | |
@@ -161,8 +155,8 @@ msgid "" | |||
| 161 | 155 | msgstr "" | |
| 162 | 156 | "인자 목록에 인식할 수 없는 옵션이 있거나 인자가 필요한 옵션에 아무것도 주어지지 않으면 발생합니다. 예외에 대한 인자는 에러의 " | |
| 163 | 157 | "원인을 나타내는 문자열입니다. 긴 옵션의 경우, 인자를 요구하지 않는 옵션에 인자가 주어질 때도 이 예외를 발생시킵니다. 어트리뷰트" | |
| 164 | - " :attr:`msg` 와 :attr:`opt`\\는 에러 메시지와 관련 옵션을 제공합니다; 예외와 관련된 특정 옵션이 없으면 " | ||
| 165 | - ":attr:`opt`\\는 빈 문자열입니다." | ||
| 158 | + " :attr:`!msg` 와 :attr:`!opt`\\는 에러 메시지와 관련 옵션을 제공합니다; 예외와 관련된 특정 옵션이 없으면 " | ||
| 159 | + ":attr:`!opt`\\는 빈 문자열입니다." | ||
| 166 | 160 | ||
| 167 | 161 | #: ../../library/getopt.rst:98 | |
| 168 | 162 | msgid "Alias for :exc:`GetoptError`; for backward compatibility." | |
@@ -184,6 +178,15 @@ msgid "" | |||
| 184 | 178 | ">>> args\n" | |
| 185 | 179 | "['a1', 'a2']" | |
| 186 | 180 | msgstr "" | |
| 181 | + ">>> import getopt\n" | ||
| 182 | + ">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" | ||
| 183 | + ">>> args\n" | ||
| 184 | + "['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" | ||
| 185 | + ">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" | ||
| 186 | + ">>> optlist\n" | ||
| 187 | + "[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" | ||
| 188 | + ">>> args\n" | ||
| 189 | + "['a1', 'a2']" | ||
| 187 | 190 | ||
| 188 | 191 | #: ../../library/getopt.rst:114 | |
| 189 | 192 | msgid "Using long option names is equally easy:" | |
@@ -204,11 +207,22 @@ msgid "" | |||
| 204 | 207 | ">>> args\n" | |
| 205 | 208 | "['a1', 'a2']" | |
| 206 | 209 | msgstr "" | |
| 210 | + ">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" | ||
| 211 | + ">>> args = s.split()\n" | ||
| 212 | + ">>> args\n" | ||
| 213 | + "['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " | ||
| 214 | + "'a2']\n" | ||
| 215 | + ">>> optlist, args = getopt.getopt(args, 'x', [\n" | ||
| 216 | + "... 'condition=', 'output-file=', 'testing'])\n" | ||
| 217 | + ">>> optlist\n" | ||
| 218 | + "[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def')," | ||
| 219 | + " ('-x', '')]\n" | ||
| 220 | + ">>> args\n" | ||
| 221 | + "['a1', 'a2']" | ||
| 207 | 222 | ||
| 208 | 223 | #: ../../library/getopt.rst:129 | |
| 209 | - #, fuzzy | ||
| 210 | 224 | msgid "In a script, typical usage is something like this:" | |
| 211 | - msgstr "스크립트에서, 일반적인 사용법은 다음과 같습니다::" | ||
| 225 | + msgstr "스크립트에서, 일반적인 사용법은 다음과 같습니다:" | ||
| 212 | 226 | ||
| 213 | 227 | #: ../../library/getopt.rst:131 | |
| 214 | 228 | msgid "" | |
@@ -241,16 +255,42 @@ msgid "" | |||
| 241 | 255 | "if __name__ == \"__main__\":\n" | |
| 242 | 256 | " main()" | |
| 243 | 257 | msgstr "" | |
| 258 | + "import getopt, sys\n" | ||
| 259 | + "\n" | ||
| 260 | + "def main():\n" | ||
| 261 | + " try:\n" | ||
| 262 | + " opts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", " | ||
| 263 | + "\"output=\"])\n" | ||
| 264 | + " except getopt.GetoptError as err:\n" | ||
| 265 | + " # 도움말 정보를 출력하고 종료합니다:\n" | ||
| 266 | + " print(err) # \"option -a not recognized\" 같은 것을 출력합니다\n" | ||
| 267 | + " usage()\n" | ||
| 268 | + " sys.exit(2)\n" | ||
| 269 | + " output = None\n" | ||
| 270 | + " verbose = False\n" | ||
| 271 | + " for o, a in opts:\n" | ||
| 272 | + " if o == \"-v\":\n" | ||
| 273 | + " verbose = True\n" | ||
| 274 | + " elif o in (\"-h\", \"--help\"):\n" | ||
| 275 | + " usage()\n" | ||
| 276 | + " sys.exit()\n" | ||
| 277 | + " elif o in (\"-o\", \"--output\"):\n" | ||
| 278 | + " output = a\n" | ||
| 279 | + " else:\n" | ||
| 280 | + " assert False, \"unhandled option\"\n" | ||
| 281 | + " process(args, output=output, verbose=verbose)\n" | ||
| 282 | + "\n" | ||
| 283 | + "if __name__ == \"__main__\":\n" | ||
| 284 | + " main()" | ||
| 244 | 285 | ||
| 245 | 286 | #: ../../library/getopt.rst:160 | |
| 246 | - #, fuzzy | ||
| 247 | 287 | msgid "" | |
| 248 | 288 | "Note that an equivalent command line interface could be produced with " | |
| 249 | 289 | "less code and more informative help and error messages by using the " | |
| 250 | 290 | ":mod:`optparse` module:" | |
| 251 | 291 | msgstr "" | |
| 252 | - ":mod:`argparse` 모듈을 사용하면 더 적은 코드로, 더욱 유용한 도움말과 에러 메시지를 제공하는 동등한 명령 줄 " | ||
| 253 | - "인터페이스를 만들 수 있습니다::" | ||
| 292 | + ":mod:`optparse` 모듈을 사용하면 더 적은 코드로, 더욱 유용한 도움말과 에러 메시지를 제공하는 동등한 명령 줄 " | ||
| 293 | + "인터페이스를 만들 수 있습니다:" | ||
| 254 | 294 | ||
| 255 | 295 | #: ../../library/getopt.rst:163 | |
| 256 | 296 | msgid "" | |
@@ -263,15 +303,20 @@ msgid "" | |||
| 263 | 303 | " opts, args = parser.parse_args()\n" | |
| 264 | 304 | " process(args, output=opts.output, verbose=opts.verbose)" | |
| 265 | 305 | msgstr "" | |
| 306 | + "import optparse\n" | ||
| 307 | + "\n" | ||
| 308 | + "if __name__ == '__main__':\n" | ||
| 309 | + " parser = optparse.OptionParser()\n" | ||
| 310 | + " parser.add_option('-o', '--output')\n" | ||
| 311 | + " parser.add_option('-v', dest='verbose', action='store_true')\n" | ||
| 312 | + " opts, args = parser.parse_args()\n" | ||
| 313 | + " process(args, output=opts.output, verbose=opts.verbose)" | ||
| 266 | 314 | ||
| 267 | 315 | #: ../../library/getopt.rst:174 | |
| 268 | - #, fuzzy | ||
| 269 | 316 | msgid "" | |
| 270 | 317 | "A roughly equivalent command line interface for this case can also be " | |
| 271 | 318 | "produced by using the :mod:`argparse` module:" | |
| 272 | - msgstr "" | ||
| 273 | - ":mod:`argparse` 모듈을 사용하면 더 적은 코드로, 더욱 유용한 도움말과 에러 메시지를 제공하는 동등한 명령 줄 " | ||
| 274 | - "인터페이스를 만들 수 있습니다::" | ||
| 319 | + msgstr "이 경우와 거의 동등한 명령 줄 인터페이스를 :mod:`argparse` 모듈을 사용해서도 만들 수 있습니다:" | ||
| 275 | 320 | ||
| 276 | 321 | #: ../../library/getopt.rst:177 | |
| 277 | 322 | msgid "" | |
@@ -285,6 +330,15 @@ msgid "" | |||
| 285 | 330 | " args = parser.parse_args()\n" | |
| 286 | 331 | " process(args.rest, output=args.output, verbose=args.verbose)" | |
| 287 | 332 | msgstr "" | |
| 333 | + "import argparse\n" | ||
| 334 | + "\n" | ||
| 335 | + "if __name__ == '__main__':\n" | ||
| 336 | + " parser = argparse.ArgumentParser()\n" | ||
| 337 | + " parser.add_argument('-o', '--output')\n" | ||
| 338 | + " parser.add_argument('-v', dest='verbose', action='store_true')\n" | ||
| 339 | + " parser.add_argument('rest', nargs='*')\n" | ||
| 340 | + " args = parser.parse_args()\n" | ||
| 341 | + " process(args.rest, output=args.output, verbose=args.verbose)" | ||
| 288 | 342 | ||
| 289 | 343 | #: ../../library/getopt.rst:189 | |
| 290 | 344 | msgid "" | |
@@ -294,23 +348,20 @@ msgid "" | |||
| 294 | 348 | msgstr "" | |
| 295 | 349 | ||
| 296 | 350 | #: ../../library/getopt.rst:195 | |
| 297 | - #, fuzzy | ||
| 298 | 351 | msgid "Module :mod:`optparse`" | |
| 299 | - msgstr "모듈 :mod:`argparse`" | ||
| 352 | + msgstr "모듈 :mod:`optparse`" | ||
| 300 | 353 | ||
| 301 | 354 | #: ../../library/getopt.rst:196 | |
| 302 | - #, fuzzy | ||
| 303 | 355 | msgid "Declarative command line option parsing." | |
| 304 | - msgstr "대안 명령 줄 옵션과 인자 구문 분석 라이브러리." | ||
| 356 | + msgstr "선언적 명령 줄 옵션 구문 분석." | ||
| 305 | 357 | ||
| 306 | 358 | #: ../../library/getopt.rst:198 | |
| 307 | 359 | msgid "Module :mod:`argparse`" | |
| 308 | 360 | msgstr "모듈 :mod:`argparse`" | |
| 309 | 361 | ||
| 310 | 362 | #: ../../library/getopt.rst:199 | |
| 311 | - #, fuzzy | ||
| 312 | 363 | msgid "More opinionated command line option and argument parsing library." | |
| 313 | - msgstr "대안 명령 줄 옵션과 인자 구문 분석 라이브러리." | ||
| 364 | + msgstr "더 견해가 강한 명령 줄 옵션과 인자 구문 분석 라이브러리." | ||
| 314 | 365 | ||
| 315 | 366 | #~ msgid "" | |
| 316 | 367 | #~ "The :mod:`getopt` module is a parser " | |
| Back | FazBrowse Home | New Git URL |
0 commit comments