摘要: 环境: Windows 2012 R2 SQL Server 2014 通过MSSQL查询数据库服务器时间,报错如下: pyodbc.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL 阅读全文
posted @ 2020-02-12 20:11 LeoShi2020 阅读(5319) 评论(0) 推荐(0) 编辑
摘要: # string to bytes # 方法一:直接复制bytes类型 b'<str>' b = b'Hello World' print(type(b)) print(b) # 方法二:转换 s = 'Hello World' b = bytes(s,encoding='utf-8') print 阅读全文
posted @ 2020-02-12 20:00 LeoShi2020 阅读(534) 评论(0) 推荐(0) 编辑
摘要: 运行环境 Windows 2012 R2 1. Windows需要打开WinRM服务,Server系统默认打开,默认端口5985 # WinRM服务查看 PS C:\Users\Administrator> winrm enumerate winrm/config/listener Listener 阅读全文
posted @ 2020-02-12 19:54 LeoShi2020 阅读(2347) 评论(1) 推荐(1) 编辑
摘要: # 获取服务信息 PS C:\Users\Administrator> Get-Service win* Status Name DisplayName Stopped WinHttpAutoProx... WinHTTP Web Proxy Auto-Discovery Se... Running 阅读全文
posted @ 2020-02-12 18:18 LeoShi2020 阅读(3869) 评论(0) 推荐(0) 编辑
摘要: 使用subprocess模块 import subprocess # 防火墙服务存在关闭状态 child1 = subprocess.Popen(["systemctl status firewalld | grep Active"], stdout=subprocess.PIPE, shell=T 阅读全文
posted @ 2020-02-12 17:40 LeoShi2020 阅读(454) 评论(0) 推荐(0) 编辑
摘要: Linux执行完命令之后默认会有一个返回值 # ls app backupconfig.json Doc manage.py __pycache__ settings.py # echo $? 0 错误对照表 "OS error code 1: Operation not permitted" "O 阅读全文
posted @ 2020-02-12 13:37 LeoShi2020 阅读(1349) 评论(0) 推荐(0) 编辑
摘要: - 错误代码如下: pip install pyodbc Looking in indexes: http://172.16.1.250/repository/douban/simple Collecting pyodbc Downloading http://172.16.1.250/reposi 阅读全文
posted @ 2020-02-12 11:02 LeoShi2020 阅读(286) 评论(0) 推荐(0) 编辑
摘要: Python 通过pyodbc 连接SQL Server 数据库驱动 安装环境 cat /etc/redhat-release CentOS Linux release 7.7.1908 (Core) 微软官网 https://docs.microsoft.com/zh-cn/sql/connect 阅读全文
posted @ 2020-02-12 10:53 LeoShi2020 阅读(4677) 评论(0) 推荐(0) 编辑
摘要: 方法一:Key Value 直接获取 databases = {1: 'Student', 2: 'School'} for k,v in databases.items(): print(k,v) 1 Student 2 School 方法二:通过循环Key获取Value databases = 阅读全文
posted @ 2020-02-12 10:50 LeoShi2020 阅读(9058) 评论(0) 推荐(0) 编辑
摘要: 用法:isinstance(变量,list) li = [1,2,3] print(type(li)) if isinstance(li,list): print("This is a List") <class 'list'> This is a List 阅读全文
posted @ 2020-02-12 10:42 LeoShi2020 阅读(10939) 评论(0) 推荐(0) 编辑