소스 검색

update README.rst

wangweimin 5 년 전
부모
커밋
ed3380a50f
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      README.rst

+ 5 - 5
README.rst

@@ -28,14 +28,14 @@ Quick start
 
 .. code-block:: python
 
-    from pywebio.input import input
+    from pywebio.input import input, FLOAT
     from pywebio.output import put_text
 
     def bmi():
-        height = input("请输入你的身高(cm):")
-        weight = input("请输入你的体重(kg):")
+        height = input("请输入你的身高(cm):", type=FLOAT)
+        weight = input("请输入你的体重(kg):", type=FLOAT)
 
-        BMI = float(weight) / (float(height) / 100) ** 2
+        BMI = weight / (height / 100) ** 2
 
         top_status = [(14.9, '极瘦'), (18.4, '偏瘦'),
                       (22.9, '正常'), (27.5, '过重'),
@@ -98,4 +98,4 @@ Quick start
 Document
 ------------
 
-使用手册和开发文档见 `https://pywebio.readthedocs.io <https://pywebio.readthedocs.io>`_
+使用手册和实现文档见 `https://pywebio.readthedocs.io <https://pywebio.readthedocs.io>`_