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("他们是绝对数")

原文地址:https://www.cnblogs.com/51testing/p/7928551.html