
python
JumHorn
这个作者很懒,什么都没留下…
展开
-
python学习日志4
python写json文件# coding: UTF-8__author__ = 'Jum''''try: f=open('./log.txt','a') #r是读,w是写,a是追加 #文件不存在就新建文件 f.write('helloworld')finally: if f: f.close()#这个写法不够简洁'''pri原创 2016-11-17 09:55:08 · 331 阅读 · 0 评论 -
python学习日志5
python面向对象:python中面向对象的属性和方法,自己调用自己都需要加上self,和java不同,经常忘记原创 2016-11-17 13:41:15 · 274 阅读 · 0 评论 -
python学习日志7
leetcode之wildcard matching解法这个是通配符的匹配与实现,只用到*,?两个字符第一次思考之恶个问题,用到了函数递归方法,即先将判断出*的字符串截取,继续调用isMatch()这个函数class WildcardMatching(object): def isMatch(self,s,p): i=0 j=0原创 2016-12-13 10:02:38 · 291 阅读 · 0 评论 -
leetcode 之 python篇1
leetcode之Minimum Moves to Equal Array Elements II解法思路大致如下:首先:最后数组的结果是nums数组中最中间的数字(nums数组排过序),这个是显而易见的然后:前半个数组移动到中数需要step=中数X数组一半的长度-前半个数组元素的和,同理,后半个数组移动需要step=后半个数组元素的和-中数X数组一半的长度,两个相加即可最后:原创 2016-12-13 16:07:05 · 308 阅读 · 0 评论 -
python字典学习笔记
leetcode之Contains Duplicate II 的解法题目描述:Given an array of integers and an integer k, return true if and only if there are two distinct indices i and j in the array such that nums[i] = nums[j]转载 2016-11-21 14:32:07 · 365 阅读 · 0 评论 -
python学习日志6
leetcode之Longest Common Prefix解法class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ if not strs:原创 2016-11-18 09:14:39 · 313 阅读 · 0 评论 -
python学习日志3
学习总结 1.unicode字符不能和str的相加减,不同于C的ascii字符,并且str类型也不支持相加减,可以用强制类型转换int()2.java类里面非静态的方法可以在类内部调用,但是python里面不能直接调用,会报错,找不到该方法,必须使用self.方法名3.不可以这样写str.join(l.reverse()),要分开l.reverse()和str.join(l)原创 2016-11-16 10:16:52 · 273 阅读 · 0 评论 -
python学习日志1
leetcode之ThirdmMaximumNumber的解法class Solution(object): def thirdMax(self, nums): """ :type nums: List[int] :rtype: int """ l=[-2147483649,-2147483649,-214原创 2016-11-14 10:59:51 · 319 阅读 · 0 评论 -
ASCII图像
之前就听过非常好玩的佛祖注释/* ......................我佛慈悲...................... * _oo0oo_ * o8888888o * 88" . "88 * (...原创 2018-01-29 17:45:27 · 2116 阅读 · 0 评论