Python3学习(1)——初步了解
Python是解析性语言,Python解释器将源程序解释并执行。
基本语法
print() --打印字符串
-直接打印
print("hello world")
结果:
hello world
-打印字符串变量
hello = 'hello world'
print(hello)
结果:
hello world
-打印unicode编码
hello = 'hello\u0020world'
print(hello)
结果:
hello world
Python根据对齐缩进来区分程序块
代码一:
while count < 5:
print(count)
# count = 100
count = count + 1 print(123)
输出结果为:
0
1
2
3
4
5
123
代码二:
count = 0
while count < 10:
print(count)
# count = 100
count = count + 1 print(123)
输出结果为:
0
123
1
123
2
123
3
123
4
123
5
123
代码一与代码二唯一的区别就是对齐不一样,导致的结果就截然不同,所以在使用python编程时必须注意代码缩进与对齐的问题。
Python3学习(1)——初步了解的更多相关文章
- Python3学习(3)-高级篇
Python3学习(1)-基础篇 Python3学习(2)-中级篇 Python3学习(3)-高级篇 文件读写 源文件test.txt line1 line2 line3 读取文件内容 f = ope ...
- Python3学习(2)-中级篇
Python3学习(1)-基础篇 Python3学习(2)-中级篇 Python3学习(3)-高级篇 切片:取数组.元组中的部分元素 L=['Jack','Mick','Leon','Jane','A ...
- Python3学习(1)-基础篇
Python3学习(1)-基础篇 Python3学习(2)-中级篇 Python3学习(3)-高级篇 安装(MAC) 直接运行: brew install python3 输入:python3 --v ...
- Python3学习笔记(urllib模块的使用)转http://www.cnblogs.com/Lands-ljk/p/5447127.html
Python3学习笔记(urllib模块的使用) 1.基本方法 urllib.request.urlopen(url, data=None, [timeout, ]*, cafile=None, ...
- Python3学习笔记 - 准备环境
前言 最近乘着项目不忙想赶一波时髦学习一下Python3.由于正好学习了Docker,并深深迷上了Docker,所以必须趁热打铁的用它来创建我们的Python3的开发测试环境.Python3的中文教程 ...
- Python3学习之路~0 目录
目录 Python3学习之路~2.1 列表.元组操作 Python3学习之路~2.2 简单的购物车程序 Python3学习之路~2.3 字符串操作 Python3学习之路~2.4 字典操作 Pytho ...
- python3学习笔记(7)_listComprehensions-列表生成式
#python3 学习笔记17/07/11 # !/usr/bin/env python3 # -*- conding:utf-8 -*- #通过列表生成式可以生成格式各样的list,这种list 一 ...
- python3学习笔记(6)_iteration
#python3 学习笔记17/07/10 # !/usr/bin/env python3 # -*- coding:utf-8 -*- #类似 其他语言的for循环,但是比for抽象程度更高 # f ...
- python3学习笔记(5)_slice
#python3 学习笔记17/07/10 # !/usr/bin/env python3 # -*- coding:utf-8 -*- #切片slice 大大简化 对于指定索引的操作 fruits ...
随机推荐
- <Dare To Dream>第五次作业:团队项目需求改进与系统设计
任务1完成情况: a.分析<家教服务管理系统需求规格说明书>初稿的不足: uml建模不完整,无类图.流程图,仅有的用例图也不规范. b.功能分析的四个象限: c. 团队项目的WBS: d. ...
- react 路由之react-router-dom
1安装react-router-dom npm install react-router-dom --save-dev //这里可以使用cnpm代替npm命令 1 新建router文件 //引入 re ...
- zip 格式解析
1.格式 https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.2.0.txt 官方文档 https://blog.csdn.net/hp9103 ...
- 线性筛素数和理解 洛谷P3383
题目链接:https://www.luogu.org/problemnew/show/P3383 线性筛法筛素数的特点是每一个数字只被遍历一次,即时间复杂度为O(n),所以说他是线性的,并且所有的非素 ...
- jquery点击回到顶部
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- How to decode input data from a contract transaction without ABI?
1 I've found some libraries which decode input from transaction, but all of them require ABI of cont ...
- break 和continue在循环中起到的作用
break语句的作用是终止当前循环,跳出循环体.主意,break只能跳出一层循环. continue语句的作用是终止本轮循环并开始下一轮循环,(这里要主意的是在开始下一轮循环之前,会先测试循环条件). ...
- 带缓冲I/O 和不带缓冲I/O的区别与联系
首先要明白不带缓冲的概念:所谓不带缓冲,并不是指内核不提供缓冲,而是只单纯的系统调用,不是函数库的调用.系统内核对磁盘的读写都会提供一个块缓冲(在有些地方也被称为内核高速缓存),当用write函数对其 ...
- AnjularJS 学习
一个不错的学习AnjularJS的网站,可以在线实践:http://www.runoob.com/angularjs/angularjs-tutorial.html
- 解决Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules
1.在eclipse的workspace里面找到该项目.settings文件夹 2.编辑org.eclipse.wst.common.project.facet.core.xml文件 <?xml ...