自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 python 读取 xls文件

import sysimport xlrd#from xlrd import open_workbook#import pandas as pdimport xlwtfile_path = 'D:\data\\gmy\\文学\\傲慢与偏见.xls'file = pd.read_html(file_path)#获取.xls工作簿对象'''sheet_name = file.sheet...

2019-09-26 15:54:52 4874 1

转载 python 读取tmx文件

转载自http://www.pianshen.com/article/4142315326/# -*- coding:utf-8 -*-import codecsimport xml.etree.ElementTree as ETimport sysdefaultencoding = 'utf-8'if sys.getdefaultencoding() != defaultenco...

2019-09-26 15:46:55 1820

原创 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte 问题

解决方案:方案一:使用notepad++打开文件,将文件转为utf-8的格式方案二:python2 中在.py文件中添加:import sysimport codecsdefaultencoding = 'utf-8'if sys.getdefaultencoding() != defaultencoding: reload(sys) sys.setdefaultenco...

2019-09-26 14:44:56 534

转载 机器翻译数据处理重要过程

机器翻译重要过程(1)—数据预处理:https://blog.csdn.net/yaoqiang2011/article/details/10273221机器翻译重要过程(2)—词语对齐 : https://blog.csdn.net/yaoqiang2011/article/details/10283995机器翻译重要过程(3)—抽取短语:https://blog.csdn.net/yaoq...

2019-09-19 18:16:12 881

原创 力扣 9. 回文数

题目来源:力扣 https://leetcode-cn.com/problemset/all/class Solution: def isPalindrome(x): ''' #使用字符串翻转 x = str(x) if x[::-1] == x: return True else:...

2019-09-03 13:44:45 182

原创 力扣 8.字符串转换整数

题目来源:力扣 https://leetcode-cn.com/problemset/all/class Solution: def myAtoi(self, str: str) -> int: #去掉左边空字符 str=str.lstrip() #如果字符串为空,返回0 if len(str)==0: ...

2019-09-03 13:22:47 219

原创 力扣 4. 寻找两个有序数组的中位数

题目来源:力扣 https://leetcode-cn.com/problemset/all/要求时间复杂度为 O(log(m + n)),下面的方法没有达到,sort()函数本质为快排其时间复杂度为:O(NlogN),一般复杂度为log的要用到二分class Solution: def findMedianSortedArrays(self, nums1: List[int], n...

2019-09-03 12:05:09 298

原创 力扣 1. 两数之和

题目来源:力扣 https://leetcode-cn.com/problemset/all/ class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: ''' 方法一:暴力遍历(时间复杂度o(n^2)...

2019-09-03 11:55:11 139

原创 力扣6. Z字形变换

题目来源:力扣https://leetcode-cn.com/problemset/all/class Solution: def convert(s, numRows): if numRows < 2: #若行数小于2则直接返回字符串 return s res = ["" for _ in range(...

2019-09-03 11:30:15 156

原创 力扣7. 整数反转

题目来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/reverse-integer著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。def reverse(x): a = [] s = str(x)#数字转换为字符串 st = '' #判断若为一位数则直...

2019-09-02 18:19:20 152

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除