从百度天气获取当地明天的天气情况,如果明天下雨,请发送邮件通知全体同事带伞, 如果明天气温低于10度,请邮件提醒同事注意保暖,如果气温高于30度则提醒同事注意高温. 假设存在发送邮件的方法self.send_email(email_content) 代码如下: #coding=utf-8 from selenium import webdriver import unittest from time import sleep class WeatherReport(unittest.TestCa
python 获取 mac 地址 的例子,有需要的朋友可以参考下. #!/bin/python import os import re def GetMac(): if os.name == 'nt': try: ret = '' CmdLine = 'ipconfig /all' r = os.popen(CmdLine).read() if r:
通过python获取当前mac地址的方法如下:(1)通用方法,借助uuid模块def get_mac_address(): import uuid node = uuid.getnode() mac = uuid.UUID(int = node).hex[-12:] return mac (2)按照操作系统平台来def get_mac_address(): ''' @summary: return the MAC address of the computer