随笔分类 -  Python基础语法

摘要:对文件操作流程 现有文件如下: 昨夜寒蛩不住鸣。 惊回千里梦,已三更。 起来独自绕阶行。 人悄悄,帘外月胧明。 白首为功名,旧山松竹老,阻归程。 欲将心事付瑶琴。 知音少,弦断有谁听。 1.open()方法: file 对象使用 open 函数来创建 with方法: 1.with方法可以省去f.cl 阅读全文
posted @ 2018-02-26 23:36 皮蛋小顽童 阅读(188) 评论(0) 推荐(0)
摘要:输入密码时,如果想要不可见,需要利用getpass 模块中的 getpass方法,即: ps:在pycharm未验证成功。 注意: input接受的数据额都是字符串类型,即使输入的是数字,也会被当做字符串处理。 可以通过 int() 来转化为数字类型 阅读全文
posted @ 2018-02-07 14:23 皮蛋小顽童 阅读(308) 评论(0) 推荐(0)
摘要:Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descri 阅读全文
posted @ 2018-02-07 02:36 皮蛋小顽童 阅读(128) 评论(0) 推荐(0)
摘要:while循环 1.基本语法 ctrl + c 退出循环 2.循环的嵌套 3.示例(使用 # 号 输出一个长方形,用户可以指定宽和高) length = int(input('please input length:')) heigh = int(input('please input heigh: 阅读全文
posted @ 2018-01-26 11:01 皮蛋小顽童 阅读(323) 评论(0) 推荐(0)
摘要:Python的数据类型: Numbers(数字) String(字符串) List(列表) Tuple(元组) Dictionary(字典) Set(集合) Numbers(数字) 数字类型分为:整数,浮点数,复数 运算: String(字符串) 字符串就是一系列字符,在Python中,用引号括起来 阅读全文
posted @ 2018-01-25 00:44 皮蛋小顽童 阅读(401) 评论(0) 推荐(0)