看一下2330.txt的結構

targetJson = r”C:\Python\Json\2330.txt”

需要寫一個settings.json的檔案


settings.json:
{‘python.defaultInterpreterPath’: ‘D:\\myInstallation\\Python310\\python.exe’, ‘files.encoding’: ‘utf8’, ‘terminal.integrated.profiles.windows’: {‘Command Prompts’: {‘path’: [‘${env:windir}\\System32\\cmd.exe’], ‘args’: [], ‘icon’: ‘terminal-cmd’}}, ‘terminal.integrated.defaultProfile.windows’: ‘Command Prompts’, ‘editor.autoIndent’: ‘advanced’}
![Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str] Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str]](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221112184006_50.png?quality=90&zoom=2&ssl=1&resize=350%2C233)






]*>.*?底下插入一個圖檔.*?</w:p>’, flags = re.DOTALL) ; new_xml, n = pattern.subn(”, xml, count=1)' title='Python正則替換:全面掌握 re.sub 與 re.subn 的差異與實戰 #substitute(替換); . 預設匹配「除\n以外的任意單一字元」; pattern = re.compile(r'<w:p[^>]*>.*?底下插入一個圖檔.*?</w:p>’, flags = re.DOTALL) ; new_xml, n = pattern.subn(”, xml, count=1)' loading='lazy' width=350 height=233 />![Python TQC考題404 數字反轉判斷,n_rev=n[::-1], list1.reverse() Python TQC考題404 數字反轉判斷,n_rev=n[::-1], list1.reverse()](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2022/04/20220825152414_97.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

近期留言