循序渐进学Python2变量与输入
新建一个test.py文件,右键选择“Edit with IDLE”,编辑完成后,Ctrl+S保存,然后按下F5就可以执行代码了。
注:IDLE是Python官方提供的一个IDE工具。
目录[隐藏] |
[编辑]注释
#This is a comment
print"This will run."#comment
多行注释使用三个单引号(''')或三个双引号(""")。
[编辑]数字
print 25 + 30 / 6
print"Is it true that 3+2 < 5-7?"
print 3+2<5-7
输出:
30 Is it true that 3+2<5-7? False
[编辑]变量
cars =100
print"There are", cars,"cars available."
输出:
There are 100 cars available.
my_name ="Lei Jun" your_name ="Jobs"
print"Let's talk about", my_name print"Let's talk about %s and %s." % (my_name, your_name)
输出:
Let's talk about Lei Jun Let's talk about Lei Jun and Jobs.
[编辑]输入用法
print"How old are you?" age =raw_input()
print"You're %s old."% age
输出:
How old are you? 27 You're 27 old.
或
age =raw_input("How old are you?")
print"You're %s old."% age
输出:
How old are you?38 You're 38 old.
循序渐进学Python2变量与输入的更多相关文章
- 循序渐进学.Net Core Web Api开发系列【7】:项目发布到CentOS7
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇讨论如 ...
- 学python2.7简单还是python3.0简单,两者区别
学python2.7简单还是python3.0简单,谈谈两者区别 1. 使用__future__模块 Python 3.X 引入了一些与Python 2 不兼容的关键字和特性.在Python 2中,可 ...
- 循序渐进学.Net Core Web Api开发系列【14】:异常处理
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍异 ...
- 循序渐进学.Net Core Web Api开发系列【13】:中间件(Middleware)
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍如 ...
- 循序渐进学.Net Core Web Api开发系列【11】:依赖注入
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇介绍如 ...
- 循序渐进学.Net Core Web Api开发系列【9】:常用的数据库操作
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 本篇描述一 ...
- 循序渐进学.Net Core Web Api开发系列【6】:配置文件appsettings.json
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.本篇概述 本篇描 ...
- 循序渐进学.Net Core Web Api开发系列【3】:WebApi开发概览
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 目前我们已 ...
- 循序渐进学.Net Core Web Api开发系列【2】:利用Swagger调试WebApi
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 既然前后端 ...
随机推荐
- P2134 百日旅行 (斜率优化,DP)
题目链接 Solution 斜率优化\(DP\). 今天下午才打的第一道题 QwQ... \(90\) 分很简单,一个简单的递推. 令 \(f[i]\) 为最后一天旅游的花费, \(g[i]\) 为最 ...
- iOS-多线程(3)
多线程之GCD(grand central dispatch)中心调度 为了简化多线程的操作,iOS为我们提供了GCD来实现编程. 使用GCD只要遵守两个步骤即可: 创建对列(串行队列,并行队列) 将 ...
- javascript之进阶
一 模态框 1 什么是模态框 模态框(Modal)是覆盖在父窗体上的子窗体.指在用户想要对对话框以外的应用程序进行操作时,必须首先对该对话框进行响应.如单击[确定]或[取消]按钮等将该对话框关闭. 2 ...
- Django标签之包含标签Inclusion tags
Django过滤器和标签功能很强大,而且支持自定义标签,很是方便:其中一种标签是Inclusion tags,即包含标签,个人感觉比较反人类的 包含标签(Inclusion tags)通过渲染其他的模 ...
- comet realization with ajax&php
1.prepare front-end code, meta content-type cannot be ignored! as to the xhr, status should be 3 < ...
- docker mysql 导入导出数据
导出数据 1.导出mysql单张表结构和数据: docker exec -it my-mysql mysqldump dbname -uroot -p123456 --tables tname > ...
- OceanBase数据库实践入门——手动搭建OceanBase集群
前言 目前有关OceanBase功能.案例.故事的文章已经很多,对OceanBase感兴趣的朋友都想安装一个数据库试试.本文就是分享初学者如何手动搭建一个OceanBase集群.这也是学习理解Ocea ...
- Android View 布局流程(Layout)完全解析
前言 上一篇文章,笔者详细讲述了View三大工作流程的第一个,Measure流程,如果对测量流程还不熟悉的读者可以参考一下上一篇文章.测量流程主要是对View树进行测量,获取每一个View的测量宽高, ...
- 微信小程序日期定位弹出框遮挡问题
只需要用bindtap绑定一个点击后的操作(隐藏键盘): wx.hideKeyboard()
- spring secrity 一些常用小知识
1.在JSP页面获取当前登录的用户名的方法 首先引入taglib:<%@ taglib prefix="sec" uri="http://www.springfra ...