[python]Replace key words of all documents in a directory
from docx import Document def replace_text_in_word(file_path, new_path, old_texts, new_text): doc = Document(file_path) for old_text in old_texts: for paragraph in doc.paragraphs: if old_text in paragraph.text: paragraph.text = paragraph.text.repl...标签: python
[linux]Copy text between host and vmware machine.
If there are troubles while coping text between host and vmware machine. Try to install vmware tool by vmware menus. After failed in this way, try to run the command: ./vmware-user If the command not exists, you can install it by command: sudo apt install ...标签: linux
[linux] ping 127.0.0.1 failed
If ping 127.0.0.1 failed. Maybe the localohst network is not available. Use the command ifconfig -a to find if the lo is available. Use the command ifocnfig lo 127.0.0.1 to enable it.标签: linux
[python]Affine Transform
import cv2 import numpy as np img = cv2.imread("book.png",1) img_org = img.copy() h,w = img.shape[:2] p1 = np.float32([[81,30],[378,80],[13,425]]) p2 = np.float32([[0,0],[300,0],[0,400]]) M = cv2.getAffineTransform(p1,p2) img = cv2.warpAffine(img,M,(w, h)) cv2.imshow("org",img_org) cv2.i...[linux]Running sftp automatically by expect tools
#!/usr/bin/expect -f send "mv ./models/weights/FCRNet.weights.h5 ./models/weights/FCRNet.weights.h5.back\r" expect "*python39*" spawn sftp -P 3222 root@log.anycle.com expect "*assword" send "dppppppppppasdas\r" expect "sftp>" set timeout -1 send "get /hy-tmp/FCRN/models/weights/FCRNet.wei...标签: linux
[linux] 文件分包压缩
tar zvf data.tar.gz data #使用split命令 #-b 3G 表示设置每个分割包的大小,单位还是可以M、k #-d 参数指定生成的分割包后缀为数字的形式 #-a x来设定序列的长度(默认值是2),这里设定序列的长度为1 split -b 3G -d -a 1 data.tar.gz data.tar.gz. #拆分文件执行命令后,生成压缩包如下,通过ll命令查看: -rw-r--r-- 1 root root 4194304000 May 20 1...标签: linux
copy files in windows
D: cd D:\workspace\ for /D %%i in (*) do copy D:\workspace\%%i\*.mp4 D:\workspace\ubifs异步文件系统挂载注意
ubifs 是一个异步的文件系统, 所以为了掉电的时候数据能保存完整, 最好使用-o sync 挂载文件系统标签: linux
[python]An example of argparse
import argparse parser = argparse.ArgumentParser() parser.add_argument('--arg1', type=int, default=2) parser.add_argument('-arg2',type=float, default=.5) parser.add_argument('arg3',type=float) args = parser.parse_args() print(args)标签: python
[python]An example of with_as
class newc: def __enter__(self): print("enter of newc\n") return self def __exit__(self,type,value,trace): print("exit of newc\n") print("type:", type) print("value:", value) print("trace:", trace) def fun(self): print...标签: python
日历
最新微语
- 有的时候,会站在分叉路口,不知道向左还是右
2023-12-26 15:34
- 繁花乱开,鸟雀逐风。心自宁静,纷扰不闻。
2023-03-14 09:56
- 对于不可控的事,我们保持乐观,对于可控的事情,我们保持谨慎。
2023-02-09 11:03
- 小时候,
暑假意味着无忧无虑地玩很长一段时间,
节假意味着好吃好喝还有很多长期不见的小朋友来玩...
长大后,
这是女儿第一个暑假,
一个半月...
2022-07-11 08:54
- Watching the autumn leaves falling as you grow older together
2018-10-25 09:45
分类
最新评论
- Goonog
i get it now :) - 萧
@Fluzak:The web host... - Fluzak
Nice blog here! Also... - Albertarive
In my opinion you co... - ChesterHep
What does it plan? - ChesterHep
No, opposite. - mojoheadz
Everything is OK!... - Josephmaigh
I just want to say t... - ChesterHep
What good topic - AnthonyBub
Certainly, never it ...