python中while循环语句用法简单实例

yipeiwu_com6年前Python基础

本文实例讲述了python中while循环语句用法。分享给大家供大家参考。具体如下:

number = 1
while number < 20:
  print(number)
  number += 1

运行结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

希望本文所述对大家的Python程序设计有所帮助。

相关文章

详解python之配置日志的几种方式

作为开发者,我们可以通过以下3中方式来配置logging: 1)使用Python代码显式的创建loggers, handlers和formatters并分别调用它们的配置函数; 2)...

python使用matplotlib绘制热图

python使用matplotlib绘制热图

python常用的绘图库就是matplotlib,今天在给公司绘图时,偶然间发现matplotlib可以绘制热图,并且十分简洁,拿出来跟大家分享一下。(由于涉及到公司数据问题,这里采用随...

Python Tkinter 简单登录界面的实现

Python Tkinter 简单登录界面的实现

如下所示: from tkinter import * class Reg (Frame): def __init__(self,master): frame = F...

pytorch 在网络中添加可训练参数,修改预训练权重文件的方法

实践中,针对不同的任务需求,我们经常会在现成的网络结构上做一定的修改来实现特定的目的。 假如我们现在有一个简单的两层感知机网络: # -*- coding: utf-8 -*- im...

总结python实现父类调用两种方法的不同

总结python实现父类调用两种方法的不同

python中有两种方法可以调用父类的方法: super(Child, self).method(args)  Parent.method(self, args) 我用其中的一...