python3.5.3rc1学习十一:字典与模块
#os模块
import os
curDir = os.getcwd()
print(curDir)
os.mkdir("新建")
import time
time.sleep(2)
os.rename("新建","文件")
time.sleep(2)
os.rmdir("文件")
#多行打印
print('''''
第一行内容
第二行内容
第三行内容
。。。。
==========================
| |
| |
| |
| Welcome |
| |
| |
| |
==========================
''')
#字典
tem = {'北京':22,'上海':23,'深圳':24,'广州':25,'南京':26}
print(tem)
tem['重庆'] = 25
print(tem)
del tem['上海']
print(tem)
tem['北京'] = 30
print(tem)
#字典中嵌套列表
tem ={'北京':[22, '多云'],'上海':[23, '晴天'],'深圳':[23, '小雨'],'广州':[23, '阴天']}
print(tem)
print(tem['北京'])
print(tem['北京'][0])
#内置函数
x = -5
y = 5
print(abs(x))
if abs(x) == y:
print("他们是绝对数")
python3.5.3rc1学习十一:字典与模块的更多相关文章
- python3.5.3rc1学习五:模块
#比较大小#name:maxNumber.py#比较两个数大小#C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\Lib\site- ...
- python3.5.3rc1学习十:网络请求
#sys模块import sys sys.stderr.write('This is stderr text\n')# 因为从定向有缓冲区,所以需要以下这行代码sys.stderr.flush()sy ...
- python3.5.3rc1学习九:正则表达式
# 正则表达式 ''''' 正则表达式是有一些特殊字符组成,能够帮你找到一些符合一定规则的字符串 先来了解几个符号所代表的意思 \d 匹配所有的数字 \D 匹配所有,但是数字除外 \s 空格 \S 匹 ...
- python3.5.3rc1学习四:类
class calculator: def add(x,y): return x + y print(added) def sub(x,y): return x - y print(sub) def ...
- python3.5.3rc1学习八:文件打包
from cx_Freeze import setup, Executable setup(name='test to exe', version = '0.1', description='test ...
- python3.5.3rc1学习七:多线程
import threading def exampleFun(): #打印当前激活的线程数量 print(threading.active_count) #查看上面激活的线程是哪几个 print(t ...
- python3.5.3rc1学习六:画图
# 可以设置颜色,g代表green, r代表red,y代表yellow,b代表blue# linewidth = 5,设置线条粗细 # label 设置线条名称 ##plt.plot(x,y,'b', ...
- python3.5.3rc1学习五:列表与元组
#元组和列表 #元组定义x = 5,6,2,6 #or x = (5,6,2,6) #列表定义 y = [5,6,2,6] # 元组的使用,我们用return语句来演示 def exampleFunc ...
- python3.5.3rc1学习三:文件操作
##全局变量与局部变量x = 6 def printFuc(): y = 8 z =9 print(y + z) print(x) printFuc()#print(y)#常见错误##name = & ...
随机推荐
- mysql-installer-community-8.0.17.0.msi安装教程
1.官网 https://dev.mysql.com/downloads/file/?id=488055 我选择自定义安装 注意这里是可以设置路径的,否则是默认地址 然后一直下一步就好 也是一路下一步 ...
- LinuxVIM编辑器用法
vi编辑器是Linux系统下标准的编辑器.而且不逊色于其他任何最新的编辑器. 基本上vi可以分为三种状态,分别是命令模式(command mode).插入模式(Insert mode)和底行模式(la ...
- JS运动---运动基础(匀速运动)
[一]运动基础 (2)基础运动案例 <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...
- 201871010116-祁英红《面向对象程序设计(java)》第十三周学习总结
博文正文开头格式:(2分) 项目 内容 <面向对象程序设计(java)> https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://ww ...
- 【攻防世界】高手进阶 pwn200 WP
题目链接 PWN200 题目和JarvisOJ level4很像 检查保护 利用checksec --file pwn200可以看到开启了NX防护 静态反编译结构 Main函数反编译结果如下 int ...
- acwing 23. 矩阵中的路径
习题地址 https://www.acwing.com/problem/content/description/21/ 题目描述请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路 ...
- acwing 76. 和为S的连续正数序列
地址 https://www.acwing.com/problem/content/description/72/ 输入一个正数s,打印出所有和为s的连续正数序列(至少含有两个数). 例如输入15,由 ...
- Spring Cloud 如何搭建eureka
Eureka Server 的搭建 eureka 是 Spring Cloud 的注册中心,提供服务注册和服务发现的功能. 利用idea 快速创建一个eureka应用File - NewProject ...
- CF620C Pearls in a Row
CF620C Pearls in a Row 洛谷评测传送门 题目描述 There are nn pearls in a row. Let's enumerate them with integers ...
- njnja 安装
git clone git://github.com/ninja-build/ninja.git && cd ninja 安装re2c wget https://kojipkgs.f ...