上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 39 下一页
摘要: 转自: https://xrlin.github.io/%E8%A7%A3%E5%86%B3python2.x%E6%96%87%E4%BB%B6%E8%AF%BB%E5%86%99%E7%BC%96%E7%A0%81%E9%97%AE%E9%A2%98/ python2.X版本在处理中文文件读写时 阅读全文
posted @ 2018-09-20 15:12 xushukui 阅读(9241) 评论(0) 推荐(3) 编辑
摘要: ``` python io.open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True),打开file对象并返回对应的数据流。如果打开失败,则抛出IOError异常。 file要么是一个指向需要被打开文件的路径字符串,或者是文件描述符序号。 mode是一个可选字符串,用来... 阅读全文
posted @ 2018-09-19 14:42 xushukui 阅读(5180) 评论(0) 推荐(0) 编辑
摘要: 1.用一个栈【python中可以用List】就可以解决,时间和空间复杂度都是O(n) 3. 在长度很大的时候可以尽快判断一些比较明显的错误的模式,节省时间: 主要的思路: 首先设置两个列表分别存放的是各种括号的开括号和闭括号,然后遍历给定的字符串,分如下几种情况: 1.字符串 首字符 出现在闭括号列 阅读全文
posted @ 2018-08-15 14:57 xushukui 阅读(6740) 评论(0) 推荐(0) 编辑
摘要: ``` python itertools模块现成的全排列: for i in itertools.permutations('abcd',4): print ''.join(i) 相关全排列算法: def perm(l): if(len(l)=end: print lis else: i = begin for n... 阅读全文
posted @ 2018-08-12 16:48 xushukui 阅读(7381) 评论(0) 推荐(0) 编辑
摘要: Python是支持可变参数的,最简单的方法莫过于使用默认参数,例如: 当然,本文章的主题并不是讲默认参数,而是另外一种达到可变参数 (Variable Argument) 的方法:使用 args和 kwargs语法。其中, args是可变的positional arguments列表, kwargs 阅读全文
posted @ 2018-08-07 21:02 xushukui 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 并集 交集 差集 对称差集 阅读全文
posted @ 2018-08-07 16:55 xushukui 阅读(1742) 评论(0) 推荐(0) 编辑
摘要: 转自: https://blog.csdn.net/mighty13/article/details/78076258?locationNum=3&fps=1 阅读全文
posted @ 2018-08-06 14:57 xushukui 阅读(596) 评论(0) 推荐(0) 编辑
摘要: 转自: https://blog.csdn.net/felcon/article/details/38524317 json的一个简单示例为: 其中“firstName”和”lastName“为健(key),“Bill”和“Gates”为值(value) 首先需要导入json包 比如最近爬爆米花视频 阅读全文
posted @ 2018-08-05 22:35 xushukui 阅读(987) 评论(0) 推荐(0) 编辑
摘要: ``` python 使用python pip安装包的时候报错: Traceback (most recent call last): File "/usr/local/bin/pip", line 7, in from pip._internal import main ImportError: No module named _internal 解决办法: python3 -... 阅读全文
posted @ 2018-08-02 16:04 xushukui 阅读(605) 评论(0) 推荐(0) 编辑
摘要: 或者 阅读全文
posted @ 2018-07-24 14:46 xushukui 阅读(5615) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 39 下一页