标签:connect www sea search exists att open string ctime
python |
---|
w3cschool |
菜鸟教程 |
Python123 |
中国大学MOOC |
正则表达式 |
---|
Python3 正则表达式_w3cschool |
pandas |
---|
API reference — pandas 0.25.1 documentation |
os.listdir([path])
os.mkdir(path)
os.system(string)
os.path.exists(path)
pathlib.Path(path).is_file()
pathlib.Path(path).is_dir()
pathlib.Path(path).exists()
shutil.copyfile(src_path, des_path)
re.match(pattern, string)
re.search(pattern, string)
re.sub(pattern, s, string)
read_excel()
read_csv()
to_excel()
to_csv()
Series()
DataFrame()
apply()
random.choice(list)
random.shuffle(list)
time.ctime()
import chardet
chardet.detect(open('0.csv', 'rb').read())['encoding']
def getEncoding(file_name):
with open(file_name, 'rb') as f:
return chardet.detect(f.read())['encoding']
def file2utf8(file_name):
with open(file_name, 'r', encoding = getEncoding(file_name)) as f:
s = f.read()
with open(file_name, 'w', encoding = 'utf-8') as f:
f.write(s)
import pandas as pd
import sqlite3 as sql
# Excel 转 数据库
pd.read_excel('age.xls').to_sql(con = sql.connect('age.db'), name = 'age', index = False)
# 数据库 转 Excel
pd.read_sql('select * from company', con = sql.connect('company.db')).to_excel('company.xls', index = False)
标签:connect www sea search exists att open string ctime
原文地址:https://www.cnblogs.com/cyd1310997/p/11937642.html