摘要: 题目描述: 第一次提交: class Solution: def removeDuplicates(self, nums) -> int: for i in range(len(nums)-1,0,-1):#注意要倒序** if nums[i]==nums[i-1]: del(nums[i]) re 阅读全文
posted @ 2019-03-10 20:55 oldby 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def merge 阅读全文
posted @ 2019-03-10 20:30 oldby 阅读(155) 评论(0) 推荐(0) 编辑
摘要: python字符串与列表的相互转换 学习内容: 1.字符串转列表 2.列表转字符串 1. 字符串转列表 str1 = "hi hello world" print(str1.split(" "))输出:['hi', 'hello', 'world'] 2. 列表转字符串 l = ["hi","hel 阅读全文
posted @ 2019-03-10 14:17 oldby 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 笔记: python if not 判断是否为None的情况 if not x if x is None if not x is None if x is not None`是最好的写法,清晰,不会出现错误,以后坚持使用这种写法。 使用if not x这种写法的前提是:必须清楚x等于None, Fa 阅读全文
posted @ 2019-03-10 13:03 oldby 阅读(359) 评论(0) 推荐(0) 编辑