新建一个test.py文件,右键选择“Edit with IDLE”,编辑完成后,Ctrl+S保存,然后按下F5就可以执行代码了。

注:IDLE是Python官方提供的一个IDE工具。

目录

[隐藏

[编辑]注释

  1. #This is a comment
  1. print"This will run."#comment
  1. 多行注释使用三个单引号(''')或三个双引号(""")。

[编辑]数字

  1. print 25 + 30 / 6
  1. print"Is it true that 3+2 < 5-7?"
  1. print 3+2<5-7

输出:

  1. 30 Is it true that 3+2<5-7? False

[编辑]变量

  1. cars =100
  1. print"There are", cars,"cars available."

输出:

  1. There are 100 cars available.
  1. my_name ="Lei Jun" your_name ="Jobs"
  1. print"Let's talk about", my_name print"Let's talk about %s and %s." % (my_name, your_name)

输出:

  1. Let's talk about Lei Jun Let's talk about Lei Jun and Jobs.

[编辑]输入用法

  1. print"How old are you?" age =raw_input()
  1. print"You're %s old."% age

输出:

  1. How old are you? 27 You're 27 old.

  1. age =raw_input("How old are you?")
  1. print"You're %s old."% age

输出:

  1. How old are you?38 You're 38 old.

循序渐进学Python2变量与输入的更多相关文章

  1. 循序渐进学.Net Core Web Api开发系列【7】:项目发布到CentOS7

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇讨论如 ...

  2. 学python2.7简单还是python3.0简单,两者区别

    学python2.7简单还是python3.0简单,谈谈两者区别 1. 使用__future__模块 Python 3.X 引入了一些与Python 2 不兼容的关键字和特性.在Python 2中,可 ...

  3. 循序渐进学.Net Core Web Api开发系列【14】:异常处理

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍异 ...

  4. 循序渐进学.Net Core Web Api开发系列【13】:中间件(Middleware)

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍如 ...

  5. 循序渐进学.Net Core Web Api开发系列【11】:依赖注入

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍如 ...

  6. 循序渐进学.Net Core Web Api开发系列【9】:常用的数据库操作

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇描述一 ...

  7. 循序渐进学.Net Core Web Api开发系列【6】:配置文件appsettings.json

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.本篇概述 本篇描 ...

  8. 循序渐进学.Net Core Web Api开发系列【3】:WebApi开发概览

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 目前我们已 ...

  9. 循序渐进学.Net Core Web Api开发系列【2】:利用Swagger调试WebApi

    系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 既然前后端 ...

随机推荐

  1. mybatis读取oracle中blob

    controller: byte[] blob = commonService.getPersonImage(bean.getIdCard()); String base64 = new String ...

  2. [POJ2417]Discrete Logging(指数级同余方程)

    Discrete Logging Given a prime P, 2 <= P < 2 31, an integer B, 2 <= B < P, and an intege ...

  3. git统计日期之间的代码改动行数

    git log --pretty=tformat: --since ==2016-10-25 --until=2016-10-27   --numstat | awk '{ add += $1 ; s ...

  4. 三读bootmem【转】

    转自:http://blog.csdn.net/lights_joy/article/details/2704788 版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[-] 11  ...

  5. 什么情况下应该使用Web Service?

    现在我将列举三种情况,在这三种情况下,你将会发现使用Web service会带来极大的好处.此后,我还会举出不应该使用Web service的一些情况. 跨越防火墙的通信 如果你的应用程序有成千上万的 ...

  6. 重复造轮子之RSA算法(一) 大素数生成

    出于无聊, 打算从头实现一遍RSA算法 第一步, 大素数生成 Java的BigInteger里, 有个现成的方法 public static BigInteger probablePrime(int ...

  7. Jenkins解决Host key verification failed

    1.在没有做任何操作时,是这样报错的 a.在任务中配置远程执行命令 rsync -raz --delete --progress  target/testweb-v1.1.jar  root@10.0 ...

  8. GitBook一个专注于帮助文档的工具

    官网:https://www.gitbook.com GitHub组织:https://github.com/gitbookio GitBook一个专注于帮助文档的工具,比如: 1.简单的左侧列表右侧 ...

  9. HTML5 Canvas实现360度全景图

    原文:http://blog.csdn.net/jia20003/article/details/17172571 很多购物网站现在都支持360实物全景图像,可以360度任意选择查看样品,这样 对购买 ...

  10. GCD CoreData 简化CoreData操作(转)

    来自会员带睡帽的青蛙的分享: 短话长说,开始写这个小工具到现在有两个月了,虽然东西少,但是很精练,改了又改,期间有不少问题 在坛子里获得了不少帮助 谢谢各位大大. 就是两个文件一个类 CoreData ...