摘要: python使用set来去重是一种常用的方法. 一般使用方法如下: # int a = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0] print "orginal:", a print list(set(a)) # str a = [str(i) for 阅读全文
posted @ 2022-05-20 16:32 笨笨和呆呆 阅读(282) 评论(0) 推荐(0)
摘要: 思路:固定一个数字+双指针,核心是要想到两数sum<target要右移,反之要左移 细节:tuple是hashable的[(1,2,3),(1,2,3)],才能用list(set(res)),list不行 阅读全文
posted @ 2022-05-20 16:31 笨笨和呆呆 阅读(31) 评论(0) 推荐(0)
摘要: https://developer.51cto.com/article/683292.html os.path 在python中也算是一个常用的模块,特别是和文件系统打交道时,涉及到文件、目录操作经常会用到,你去看一些框架的源代码的时候也经常会使用到这些方法。 如果去看官方文档,os.path 大概 阅读全文
posted @ 2022-05-20 13:52 笨笨和呆呆 阅读(32) 评论(0) 推荐(0)
摘要: from distutils.core import setupfrom Cython.Build import cythonizeimport osimport shutil# import argparse# parser = argparse.ArgumentParser() ###和自带参数 阅读全文
posted @ 2022-05-20 13:49 笨笨和呆呆 阅读(331) 评论(0) 推荐(0)