上一页 1 ··· 8 9 10 11 12 13 14 15 下一页

2019年11月28日

摘要: 使用sys.exit 或者exit,quit均可以退出执行 # 程序执行中,需要时停止执行 import sys if __name__ == '__main__': for ii in range(10): if ii<5: print(ii) else: # exit() # quit() sy 阅读全文
posted @ 2019-11-28 19:49 落日峡谷 阅读(3935) 评论(0) 推荐(0) 编辑

2019年11月26日

摘要: 1. 判断目录是否存在 'isdir',删除目录时只有该目录为空才可以 'rmdir' import os if(os.path.isdir('D:/Python_workspace/spyder_space/test_各种功能/哈哈哈哈')): #判断目录是否存在 print('yes') os. 阅读全文
posted @ 2019-11-26 22:16 落日峡谷 阅读(408) 评论(0) 推荐(0) 编辑

2019年11月22日

摘要: 方法一: 1. python连接mysql数据库:需要用到 pymysql 库和 sqlalchemy库: import pandas as pd from sqlalchemy import create_engine import pymysql 创建连接 create_engine: con_ 阅读全文
posted @ 2019-11-22 21:36 落日峡谷 阅读(7987) 评论(0) 推荐(0) 编辑
摘要: 1. 显示昨天(前一天)的日期 from datetime import date, timedelta yesterday_date = (date.today() + timedelta(days = -1)).strftime("%Y-%m-%d") #输出:2019-11-21 yester 阅读全文
posted @ 2019-11-22 20:49 落日峡谷 阅读(1745) 评论(0) 推荐(0) 编辑

2019年11月19日

摘要: 1. 匹配:like 关键字 #假设存在表 my_test_copy select * from my_test_copy; 则使用like关键词匹配:注意下划线 '_'和百分号 '%' # 下划线'_'匹配任意单个字符 # 百分号'%'匹配任意数目的字符 select * from my_test 阅读全文
posted @ 2019-11-19 22:25 落日峡谷 阅读(25406) 评论(0) 推荐(1) 编辑
摘要: 删除主键时,出错:[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key alter table table_name drop primar 阅读全文
posted @ 2019-11-19 21:33 落日峡谷 阅读(2600) 评论(0) 推荐(0) 编辑
摘要: 添加主键时,出现错误:[Err] 1068 - Multiple primary key defined #增加主键 alter table my_test add phone_number VARCHAR(30) not null; update my_test set phone_number= 阅读全文
posted @ 2019-11-19 21:27 落日峡谷 阅读(6417) 评论(0) 推荐(0) 编辑

2019年11月17日

摘要: sql中的时间格式转换主要有:date_format函数,str_to_date函数 1. 首先选择一个数据库 use db_name; 2. 显示当前时区的时间: SELECT NOW(); 3. 按照格式显示,使用 date_format 函数: select date_format(NOW() 阅读全文
posted @ 2019-11-17 22:08 落日峡谷 阅读(4155) 评论(0) 推荐(0) 编辑
摘要: 1. 建立分区表 create table 单分区表:其中分区字段是partdate,注意分区字段不能和表字段一样,否则会报重复的错 create table test_t2(words string,frequency string) partitioned by (partdate string 阅读全文
posted @ 2019-11-17 21:36 落日峡谷 阅读(28865) 评论(0) 推荐(0) 编辑
摘要: 1. 首先一个标准的excel表格,如下: 2. 在同一行,后面一个单元格,英文输入法状态下输入以下:=CONCATENATE() =CONCATENATE("insert into table_name(first_label,second_label,third_label) VALUES('" 阅读全文
posted @ 2019-11-17 20:42 落日峡谷 阅读(412) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 下一页

导航