2018年8月24日

【python】通过LibreOffice把html文件转换成docx文件

摘要: 通过下面的一行命令,把test.html转换成test.docx soffice --invisible --headless --convert-to docx:"Office Open XML Text" test.html 如果想要用python来执行这个命令的话:(请注意"Office Op 阅读全文

posted @ 2018-08-24 16:25 芽衣 阅读(1057) 评论(0) 推荐(0) 编辑

【python】判断一个地址是ipv4还是ipv6

摘要: from netaddr.ip import IPAddress def isIP4or6(cfgstr): ipFlg = False if '/' in cfgstr: text = cfgstr[:cfgstr.rfind('/')] else: text = cfgstr try: addr = IPAddress(text) ipFlg = True ... 阅读全文

posted @ 2018-08-24 14:29 芽衣 阅读(8026) 评论(0) 推荐(0) 编辑

【python】判断一个字符串是否是数字

摘要: def is_number(s): try: float(s) return True except ValueError: pass try: import unicodedata unicodedata.numeric(s) return True except (TypeError, ValueError): pass return False... 阅读全文

posted @ 2018-08-24 11:20 芽衣 阅读(5645) 评论(1) 推荐(0) 编辑

【python】ImportError: cannot import name 'QWebView'

摘要: 报错原因:WebEngine和WebKit混合在一起使用解决方法:下面两种写法选其中一种写法。WebEngine:from PyQt5.QtWebEngineWidgets import QWebEnginePagefrom PyQt5.QtWebEngineWidgets import QWebE 阅读全文

posted @ 2018-08-24 08:22 芽衣 阅读(2863) 评论(0) 推荐(0) 编辑

【python】ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

摘要: 解决方法:把旧的写法from PyQt5.QtWebKitWidgets import *改成新的写法from PyQt5.QtWebEngineWidgets import * 参考来自:https://blog.csdn.net/karmacode/article/details/8055815 阅读全文

posted @ 2018-08-24 08:21 芽衣 阅读(6857) 评论(1) 推荐(0) 编辑

导航