Toggle navigation
Nalido Blog
Home
About
Portfolio
Tags
Nalido Blog
一生想做一条无忧无虑的哈士奇
[leetcode] 二叉树的非递归遍历
https://leetcode.com/problems/binary-tree-inorder-traversal/ 迭代框架 while(node != null || !stack.isEmpty()) { while (node != null) { stack.push(node); // 先序遍历 node = nod...
Posted by Nalido on January 26, 2021
[python3] 打开文件open函数的坑
Python3中打开文件的open函数和python2不同,经常会导致各种莫名其妙的错误. 例如读取json时,以下代码在Python2中可以正常运行. with open(jsFile, "a+") as f: try: dct = json.load(f) except ValueError as e: print('load json ...
Posted by Nalido on April 27, 2018
[python] 使用多个分隔符分割字符串
Python中字符串分割成数组,一般用split。但是split只支持单个分隔符的分割,如果想要同时使用多个分隔符,可以使用re模块。
Posted by Nalido on April 27, 2018
FEATURED TAGS
编程笔记
python