摘要: 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供的接口进行访问,不能用 from xxx i 阅读全文
posted @ 2021-04-07 10:21 门前塘 阅读(2) 评论(0) 推荐(0)
摘要: 描述 int() 函数用于将一个字符串或数字转换为整型。 语法 class int(x, base=10) 其中x – 字符串或数字,base – 进制数,默认十进制。 实例 >>>int() # 不传入参数时,得到结果0 0 >>> int(3) 3 >>> int(3.6) 3 >>> int( 阅读全文
posted @ 2021-04-07 10:08 门前塘 阅读(3) 评论(0) 推荐(0)
摘要: s1 = input("input a coordinate:") s2 = input("input another coordinate:") s3 = int(s1[0]) * int(s2[0]) print(s3) 运行后输入分别输入两个坐标,如图所示: 出现错误ValueError:in 阅读全文
posted @ 2021-04-07 10:01 门前塘 阅读(1) 评论(0) 推荐(0)