![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
xuwang777
这个作者很懒,什么都没留下…
展开
-
基于同城同校的推荐--(1)
import mysql.connector conn=mysql.connector.connect(host='',user='',password='',port='',database='') #远程连接 cursor=conn.cursor() cursor.execute('select * from table') #执行sql语句操作 t=cursor.fetcha...原创 2018-08-30 18:15:12 · 177 阅读 · 0 评论 -
推荐--(2)
1. 写入csv pd.to_csv('x.csv',index=False,header=True,encoding='utf-8') 2. 创建矩阵,初始为0 np.zeros((row_num,col_num)) 3. 排序 pd.sort_values(by='col_name').reset_index(drop=True) 4. 遍历df for index,row in...原创 2018-08-30 21:33:28 · 184 阅读 · 0 评论 -
letcode----1---two sum
我的方法:复杂度sqrt(n). 思路:现将nums备份,将nums排序,再从两端逐步向中间靠拢,寻找nums[i]+nums[j]=target。输出nums[i],nums[j]再备份中的index。函数list.index(value) list.index(val,start,end)----在这个范围内寻找val第一次出现的index。 如果val出现多次,可以将前一次出现的ind...原创 2018-09-12 20:02:53 · 154 阅读 · 0 评论 -
letcode-13-roman to integer
python: sum=0 d={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000} for i in range(len(s)-1): if d[s[i]]<d[s[i+1]]: sum=sum-d.get(s[i]) ...原创 2018-09-17 17:13:56 · 111 阅读 · 0 评论 -
letcode-7-palindorem
java: int->string public boolean isPalindrome(int x) { String s=Integer.toString(x); int l=s.length(); for(int i=0;i<l;i++) { /*若想取单个字符,substring(begin,begin+...原创 2018-09-17 21:35:19 · 120 阅读 · 0 评论 -
letcode-7-reverse interger
python: python 的int不会越界,自带大数运算。所以必须判断反转后的值是否为32位。 import math def reverse(self, x): #如果溢出int,返回0 p=[] if (x>-(math.pow(2,31))) & (x<2**31-1): s=s...原创 2018-09-13 22:02:42 · 116 阅读 · 0 评论 -
读取SpreadSheetML,建立6个词云
xml为SpreadSheetML格式(Excel的xml格式)。具体:https://blog.csdn.net/lmhuanying1012/article/details/78753851 经过删除<Style></Style>之后为 ps:一定要检查文件是否完整。解析错误可能是文件有问题。这个文件不完整,报错 parse unkown line 5443...原创 2018-10-18 22:09:50 · 243 阅读 · 0 评论