转:https://www.tuicool.com/wx/MB7nieb

数据类型

  1. 整数,
  2. 浮点数,
  3. 字符串,
  4. 布林值(True,False)
  5. 列表(list),
  6. 不可变的列表 Tuple,
  7. 集合(没有顺序的概念),set
  8. 字典(key value pair),
  9. 变量.

后面其实就是解析一下上面的数据类型是如何使用,有那些规则。

说明

列表是有顺序分可修改和不可修改两种。

[ ] 代表列表,[3,4,5]  [‘hello’,’world’],中括号

不能修改的列表 tuple,括号

(3,4,5) , (‘hello’, ‘world’)

集合 set,没有顺序的概念,大括号

{3,4,5}

字典

{‘apple’: ‘苹果’, ‘data’:’数据’}

变量,可以是任意字母,开头不能是数字

字符串

A='hello'
B='world'
C=A*3+B
print (C)

打印出来就是

hellohellohelloworld

x**y 次方

单引号,双引号,多行文字

整数除法  7//6 =1

小数除法  7/6

取余数 7%6  1

s=’hello’

print(s[1:4])

密码换位

A=input('请输入你的密码,可以数字,特殊符号和文字:')

L=len(A)

print (A[3:L]+A[0:3])
print (A[3:]+A[:3])

上面的写法,

A=[12,60,15,70,90]
A[0]=50
print (A)
A[1:4]=[]
print (A)

对列表的12,更新成50,删除内容

[50, 60, 15, 70, 90]
[50, 90]

最新文章

  1. ASP.NET MVC5----了解我们使用的@HTML帮助类
  2. BZOJ 2693: jzptab [莫比乌斯反演 线性筛]
  3. mysql select语句解析
  4. jenkins配置记录(2)--代码发布流程
  5. OPENSSL编程入门学习
  6. 北邀 E Elegant String
  7. 布局(layout)文件图形界面不能显示:An error has occurred. See error log for more details. java.lang.NullPointe
  8. 帝国cms7.0整合百度编辑器ueditor教程
  9. div内嵌p,div等块元素出现的问题
  10. 枚举算法总结 coming~^.*
  11. 关于laravel框架的跨域请求/jsonp请求的理解
  12. python学习笔记1-python相关应用套件
  13. Mysql必知必会 第一章 了解SQL
  14. Error:Failed to resolve: com.android.support:appcompat-v7
  15. JMeter学习-041-响应数据中文乱码解决方法
  16. [HDU1598]find the most comfortable road
  17. centos php Zookeeper kafka扩展安装
  18. const的详解
  19. 开发移动端web页面click事件失效问题
  20. python 在Unicode和普通字符串 str 之间转换

热门文章

  1. 【LeetCode】34. Find First and Last Position of Element in Sorted Array 解题报告(Python & C++)
  2. 【LeetCode】825. Friends Of Appropriate Ages 解题报告(Python)
  3. 【LeetCode】678. Valid Parenthesis String 解题报告(Python)
  4. vue create 初步解析以及定制化修改
  5. css--深入理解z-index引发的层叠上下文、层叠等级和层叠顺序
  6. uniCloud爬虫获取网页数据
  7. [黑科技]pb_ds库(G++)
  8. MySQL高级查询与编程笔记 • 【目录】
  9. Eclipse中英文对照表(整理笔记)
  10. 加深理解Java异常概念并熟记5个最常见的运行时异常