- 博客(19)
- 收藏
- 关注
原创 Mac MySQL 8.0.12 --secure-file-priv问题解决方案 数据导入导出相关设置 ERROR 1290 (HY000)
这学期刚学数据库要用到MySQL,我在导入数据时遇到了如下报错:ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement.几经探索,终于解决了这一问题。首先,这个问题简单来说就是MySQL设置了一个变量secure-...
2018-10-12 01:34:19
4655
原创 sklearn学习
代码:from sklearn import datasets, cross_validationfrom sklearn.naive_bayes import GaussianNBfrom sklearn.svm import SVCfrom sklearn.ensemble import RandomForestClassifierfrom sklearn import metrics...
2018-06-20 16:56:50
341
原创 Scipy学习
引入模块,设置随机数种子import numpy as npfrom scipy import optimizeimport timenp.random.seed(np.int64(time.time()))m = 20n = 10A = np.random.random(size = [m, n])b = np.random.random(size = [m])num0 = np...
2018-06-05 21:38:15
645
原创 Matplotlib学习
引入模块、设置随机数种子、设置图表输出外观:import numpy as np import matplotlib.pyplot as plt import seaborn as sns import timenp.random.seed(np.int64(time.time()))sns.set_style("darkgrid")f, ax = plt.subplots(1,...
2018-05-30 15:21:15
209
原创 Numpy学习
下载numpy库:在cmd中直接输入命令行即可pip install numpy在python命令行中输入import numpy测试是否安装成功,如图则成功下面是练习:首先导入模块和设置随机数种子import numpy as npimport timenp.random.seed(np.int64(time.time()))生成高斯随机项矩阵A和托普利兹矩阵Bdef toeplitz(X...
2018-05-22 11:39:28
396
原创 LeetCode 213. House Robber II
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is ...
2018-05-02 17:45:41
164
原创 LeetCode 189. Rotate Array
Given an array, rotate the array to the right by k steps, where k is non-negative.Example 1:Input: [1,2,3,4,5,6,7] and k = 3Output: [5,6,7,1,2,3,4]Explanation:rotate 1 steps to the right: [7,1,2,3,...
2018-05-01 15:33:04
153
原创 LeetCode 26. Remove Duplicates from Sorted Array
Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modifying...
2018-04-26 20:41:58
113
原创 LeetCode 66. Plus One
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element i...
2018-04-26 20:15:30
154
原创 Python学习(十)
10-1 Python学习笔记 :在文本编辑器中新建一个文件,写几句话来总结一下你至此学到的Python知识,其中每一行都以“In Python you can”打头。将这个文件命名为learning_python.txt,并将其存储到为完成本章练习而编写的程序所在的目录中。编写一个程序,它读取这个文件,并将你所写的内容打印三次:第一次打印时读取整个文件;第二次打印时遍历文件对象;第三次打印时将各...
2018-04-14 21:37:57
629
原创 Python学习(九)
9-1 餐馆 :创建一个名为Restaurant 的类,其方法__init__() 设置两个属性:restaurant_name 和cuisine_type 。创建一个名为describe_restaurant() 的方法和一个名为open_restaurant() 的方法,其中前者打印前述两项信息,而后者打印一条消息,指出餐馆正在营业。根据这个类创建一个名为restaurant 的实例,分别打印...
2018-04-09 08:53:27
227
原创 Python学习(八)
8-2 喜欢的图书 :编写一个名为favorite_book() 的函数,其中包含一个名为title 的形参。这个函数打印一条消息,如One of my favorite books isAlice in Wonderland 。调用这个函数,并将一本图书的名称作为实参传递给它。def favorite_book(title): print("One of my favorite book...
2018-04-01 15:13:32
910
原创 Python学习(七)
7-2 餐馆订位 :编写一个程序,询问用户有多少人用餐。如果超过8人,就打印一条消息,指出没有空桌;否则指出有空桌。sum = input('How many people come here to have dinner?\n')sum = int(sum)if sum > 8: print("Sorry, we don't have enough tables!")else...
2018-03-27 11:16:07
379
原创 Python学习(六)
教材:《Python》从入门到实践习题注:本节中相似题目过多,故有大量删减6-1 人 :使用一个字典来存储一个熟人的信息,包括名、姓、年龄和居住的城市。该字典应包含键first_name 、last_name 、age 和city 。将存储在该字典中的每项信息都打印出来。Easyin = { 'firsrt_name':'Jiyi', 'last_name':'Yin', ...
2018-03-20 00:50:13
248
原创 Python学习(五)
教材:《Python》从入门到实践习题5-3 ~5-5外星人颜色#1 :假设在游戏中刚射杀了一个外星人,请创建一个名为alien_color 的变量,并将其设置为'green' 、'yellow' 或'red' 。如果外星人是绿色的,就打印一条消息,指出玩家获得了5个点。如果外星人是黄色的,就打印一条消息,指出玩家获得了10个点。如果外星人是红色的,就打印一条消息,指出玩家获得了15个点。编写这个...
2018-03-19 23:35:06
578
原创 Python学习(四)
教材:《Python》从入门到实践习题4-1 比萨:想出至少三种你喜欢的比萨,将其名称存储在一个列表中,再使用for 循环将每种比萨的名称都打印出来。 在程序末尾添加一行代码,它不在for 循环中,指出你有多喜欢比萨。输出应包含针对每种比萨的消息,还有一个总结性句子,如“I really love pizza!”。 pizzas = ['chicken', 'fruit', 'beef']for...
2018-03-16 00:24:06
1229
原创 Python学习(三)
教材:《Python》从入门到实践习题3-4 嘉宾名单 :如果你可以邀请任何人一起共进晚餐(无论是在世的还是故去的),你会邀请哪些人?请创建一个列表,其中包含至少3个你想邀请的人;然后,使用这个列表打印消息,邀请这些人来与你共进晚餐。dinner = ['Alice', 'David', 'Jack']print(dinner[0] + ', ' + dinner[1] + ' and ' + ...
2018-03-12 22:17:38
1099
原创 Python学习(一)
我从大学本科二年级春季学期的第一天,也就是这周一,开始正式学习Python。什么是PythonPython是一种面向对象的解释型计算机程序设计语言。Python的特点 简单易学:Python具有极其简单的语法,对初学者来说相当友好。免费开源:Python是FLOSS(自由/开放源码软件)之一。解释性:直接从源代码运行程序。丰富的库:Python具有庞大且强大的库,这使其具有广泛的应用。.........
2018-03-06 20:16:26
195
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅