Python 常用包

包名 说明
NLTK 自然语言包
NumPy 科学计算库,支持多维数组和线性代数,在某些计算概率、标记、聚类和分类任务中使用
Matplotlib 数据可视化的 2D 绘图库
import sys
for dir in sys.path:
    print(dir)

import os 
current_dir = os.getcwd();
os.makedir('dir');
os.listdir('.')
stats = os.stat('new.txt');

from datetime imoort datetime
datetime.from(stats.st_atime)

impot json
f = open('city.json','rw')
cities = json.load(f)
json.dump(cities,f,indent=2)
f.close

import sqlite3
conn = sqlite3.connect('test.db')
cursor = conn.cursor()
sql = 'create table students(id int,name text,username text)'
cursor.execute(sql)
insert_sql = 'insert into students(id,name,username) values(:id,:name,:username)'
cursor.execute(sql,'id':1,'name':'Tom','username':'NickName')
conn.commit()
select_sql = 'select * from students'
results = cursor.execute(sql)
students = results.fetchall()
cursor.close()

你可能感兴趣的:(Python)