I was running an old script for one of my client today. The script was written in Python. And I was running python 3.7.4 while…
Category: python
When you working with Python Flask application, you may found the following error: builtins.ModuleNotFoundError ModuleNotFoundError: No module named ‘psycopg2’ This means you want to use…
This article is demo how to install and configure virtualenv on a Windows 10 machine. Install virtualenv. Open CMD or PowerShellPS C:py_projects> pip install virtualenv…
Recently, I’ve been working on the Azure Stack Development Toolkit API to basically figure out how to retrieve the usage data from Azure Stack. The…
本篇将介绍如何用Python来检测多台远端服务器的IP。 这里将需要使用到socket module 以下脚本会在当前的目录下创建一个txt文件final.txt。 然后需要将所有的server name写在hostnames.txt下面。 当运行完脚本后,final.txt下就会有最终的结果。 import socketh = open(‘hostnames.txt’,’r’)f = open(‘final.txt’,’w+’)for line in h: try: IP = socket.gethostbyname(line.strip()) f.write(line.strip()+’,’+IP+’n’) except Exception: f.write(line.strip()+’,’+’unable to…