Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c303e8

Browse files
committed
[po] auto sync bot
1 parent 0662dec commit 4c303e8

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

faq/programming.po

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,8 @@ msgid ""
10781078
"``int('144') == 144``. Similarly, :func:`float` converts to floating-point,"
10791079
" e.g. ``float('144') == 144.0``."
10801080
msgstr ""
1081+
"对于整数,可使用内置的 :func:`int` 类型构造器,例如 ``int('144') == 144``。 类似地,可使用 "
1082+
":func:`float` 转换为浮点数,例如 ``float('144') == 144.0``。"
10811083

10821084
#: ../../faq/programming.rst:860
10831085
msgid ""
@@ -1088,6 +1090,9 @@ msgid ""
10881090
"interpreted using Python's rules: a leading '0o' indicates octal, and '0x' "
10891091
"indicates a hex number."
10901092
msgstr ""
1093+
"默认情况下,这些操作会将数字按十进制来解读,因此 ``int('0144') == 144`` 而 ``int('0x144')`` 会引发 "
1094+
":exc:`ValueError`。 ``int(string, base)`` 接受第二个可选参数指定转换的基数,例如 ``int('0x144', "
1095+
"16) == 324``。 如果指定基数为 0,则按 Python 规则解读数字:前缀 '0o' 表示八进制,而 '0x' 表示十六进制。"
10911096

10921097
#: ../../faq/programming.rst:866
10931098
msgid ""
@@ -1098,13 +1103,18 @@ msgid ""
10981103
"``__import__('os').system(\"rm -rf $HOME\")`` which would erase your home "
10991104
"directory."
11001105
msgstr ""
1106+
"如果你只是想将字符串转为数字,请不要使用内置函数 :func:`eval`。 :func:`eval` "
1107+
"的速度会慢很多并且有安全风险:别人可能会传入具有你不想要的附带效果的 Python 表达式。 例如,别人可以传入 "
1108+
"``__import__('os').system(\"rm -rf $HOME\")`` 这将删除你的家目录。"
11011109

11021110
#: ../../faq/programming.rst:873
11031111
msgid ""
11041112
":func:`eval` also has the effect of interpreting numbers as Python "
11051113
"expressions, so that e.g. ``eval('09')`` gives a syntax error because Python"
11061114
" does not allow leading '0' in a decimal number (except '0')."
11071115
msgstr ""
1116+
":func:`eval` 还具有将数字解读为 Python 表达式的效果,这样 ``eval('09')`` 将会导致语法错误,因为 Python "
1117+
"不允许十进制数的首位是 '0' ('0' 除外)。"
11081118

11091119
#: ../../faq/programming.rst:879
11101120
msgid "How do I convert a number to a string?"

0 commit comments

Comments
 (0)