Skip to content

Commit 1260d28

Browse files
author
ducheng
committed
EX.Explicit typecast of strings
1 parent 3c64b48 commit 1260d28

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ So, here we go...
7878
- [Section: Miscellaneous](#section-miscellaneous)
7979
- [> `+=` is faster/更快的 `+=` ](#--is-faster更快的-)
8080
- [> Let's make a giant string!/来做个巨大的字符串吧!](#-lets-make-a-giant-string来做个巨大的字符串吧)
81-
- [> Explicit typecast of strings](#-explicit-typecast-of-strings)
81+
- [> Explicit typecast of strings/字符串的显式类型转换](#-explicit-typecast-of-strings字符串的显式类型转换)
8282
- [> Minor Ones](#-minor-ones)
8383
- [Contributing](#contributing)
8484
- [Acknowledgements](#acknowledgements)
@@ -2267,12 +2267,12 @@ def convert_list_to_string(l, iters):
22672267
22682268
---
22692269
2270-
### > Explicit typecast of strings
2270+
### > Explicit typecast of strings/字符串的显式类型转换
22712271
22722272
```py
22732273
a = float('inf')
22742274
b = float('nan')
2275-
c = float('-iNf') #These strings are case-insensitive
2275+
c = float('-iNf') # 这些字符串不区分大小写
22762276
d = float('nan')
22772277
```
22782278
@@ -2290,7 +2290,7 @@ ValueError: could not convert string to float: some_other_string
22902290
True
22912291
>>> None == None # None==None
22922292
True
2293-
>>> b == d #but nan!=nan
2293+
>>> b == d #但是 nan!=nan
22942294
False
22952295
>>> 50/a
22962296
0.0
@@ -2300,9 +2300,9 @@ nan
23002300
nan
23012301
```
23022302
2303-
#### 💡 Explanation:
2303+
#### 💡 说明:
23042304
2305-
`'inf'` and `'nan'` are special strings (case-insensitive), which when explicitly typecasted to `float` type, are used to represent mathematical "infinity" and "not a number" respectively.
2305+
`'inf'` `'nan'` 是特殊的字符串(不区分大小写), 当显示转换成 `float` 型时, 它们分别用于表示数学意义上的 "无穷大" 和 "非数字".
23062306
23072307
---
23082308

0 commit comments

Comments
 (0)