Python Wiki
Jump to navigation
Jump to search
Code samples
class pwDevice: def __init__(self): mac = commands.getoutput("ifconfig eth0| grep HWaddr | awk '{ print $5 }'").strip() self.mac = mac.translate(None,':') if os.path.exists('/ltrx_user/pwxcr/pwxc_hspa_import.xcr'): self.type = "PremierWave XC HSPA+" self.import_file = '/ltrx_user/pwxcr/pwxc_hspa_import.xcr' elif os.path.exists('/ltrx_user/pwxcr/pwxn_import.xcr'): self.type = "PremierWave XN" self.import_file = '/ltrx_user/pwxcr/pwxn_import.xcr' elif os.path.exists('/ltrx_user/pwxcr/pwen_import.xcr'): self.type = "PremierWave EN" self.import_file = '/ltrx_user/pwxcr/pwen_import.xcr' elif os.path.exists('/ltrx_user/pwxcr/pwse1000_import.xcr'): self.type = "PremierWave SE1000" self.import_file = '/ltrx_user/pwxcr/pwse1000_import.xcr' else: self.type = "Unknown"