摘要: 算法题:判断一个字符串S是否由其他两个字符串A, B混合而成。(混合时字符顺序不变) 例如: A: "chdkeold" B: "jgkhqp" S: "chdjkgkheqopld" 输出: True A: "aebc" B: "axbd" S: "axaebdbc" 输出: True (做了一道 阅读全文
posted @ 2020-03-07 14:31 成民 阅读(850) 评论(0) 推荐(0) 编辑
摘要: 1. 有一个shell脚本 a.sh \ !/bin/bash \ /home/test/a.sh i=0 while [ $i lt 2 ] do sleep 70 echo 'good' let i++ done 2. 会报错: [1] 21:26:32 [FAILURE] host1 Time 阅读全文
posted @ 2019-12-15 21:43 成民 阅读(1250) 评论(0) 推荐(0) 编辑
摘要: 本文主要记录一些bash的语法,备忘 英文还行的话,看看这篇Bash Guide for Beginners ###1. 进制转换 \(echo\)(( 2#11 )) 3 \(echo\)(( 16#1E )) 30 即将指定进制的数转为10进制,例如上面是将16进制的数1E转为10进制,所以结果 阅读全文
posted @ 2019-10-30 22:16 成民 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 首先, bash中命令执行成功返回状态码 0, 失败返回非0状态码(以下$是终端提示符) \(true; echo\)? 0 \(false; echo\)? 1 1. while $ while true; do echo good; break; done good $ while [ 1 -e 阅读全文
posted @ 2019-10-27 00:15 成民 阅读(476) 评论(0) 推荐(0) 编辑
摘要: 1. WSGI协议 start_response(status, response_headers) status str response a list of (header_name, header_value) tuples describing the HTTP response heade 阅读全文
posted @ 2019-09-14 22:25 成民 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 1. 生成parser import argparse parser = argparse.ArgumentParser(description='Process some integers.') 个人觉得比较好用的是: parser = argparse.ArgumentParser( forma 阅读全文
posted @ 2019-09-02 23:27 成民 阅读(168) 评论(0) 推荐(0) 编辑
摘要: vim 光标移动 w 向右移动一个单词(移到下一个单词的首字符) b 向左移动一个单词 e 向右移动到单词的词尾 ge 向左移动到单词的词尾 $ 移到行尾 0 移到行首 ^ 移动到第一个非空字符 % 在相互配对的括号( 即([{ )上跳转 参考: vim光标移动 vim常用命令总结 (转) 阅读全文
posted @ 2019-07-14 10:15 成民 阅读(316) 评论(0) 推荐(0) 编辑
摘要: 以下第一个字符对应为: c + a 光标移到行首 c + e 移到行尾 c + b 左移一个字符 c + f 右移一个字符 a + b 左移一个单词 a + f 右移一个单词 c + ] x 右移到x字符 c + a + ] x 左移到x字符 c + t 交换光标前两个字符 c + u 删到行首 c 阅读全文
posted @ 2019-06-29 10:43 成民 阅读(286) 评论(0) 推荐(0) 编辑
摘要: `from collections import Iterable, Iterator` 1. 可迭代(iterable)对象 参考 "官网链接" 2. 迭代器(iterator) 参考 "官网链接" 3. 生成器(generator) 参考 "官网链接" 4. 总结 1. 只要实现了__iter_ 阅读全文
posted @ 2019-04-14 18:05 成民 阅读(173) 评论(0) 推荐(0) 编辑
摘要: ```python class HeapStructure: def __init__(self, ls): self.ls = ls def shift_up(self, index): 上移使符合堆要求 if index == 0: return ls = self.ls par_index = 阅读全文
posted @ 2019-04-13 13:08 成民 阅读(298) 评论(0) 推荐(0) 编辑