On Jun 14, 12:06 pm, rat attack <[email protected]> wrote:
> So I'm writing a new app, it fetches data from a MySQL db of other
> software, I pick up these three models:
>
> external_serial = models.CharField("Direccion Mac
> 1",max_length=192, blank=True)
> mac_address = models.CharField("Direccion Mac 2",max_length=765,
> blank=True)
> computer_id = models.CharField("Direccion Mac 3",max_length=192,
> primary_key=True)
>
> This are supposed to be mac addresses but they come in weird format,
> for example:
>
> =====================
> external_serial =
> 00-18-FE-FF-7D-22
>
> external_serial=
> 00:80:5A:46:0A:C2 (0.0.0.0) , 00:18:FE:FF:7D:22 (147.83.76.73)
>
> computer_id=
> HP-CZC6492QRZ
> =====================
>
> Is it possible to extract just the real mac addrs (maybe via reg exp)
> and creating the models with them?
To extract the mac addresses you could use a regex like:
re_mac_address = re.compile(r"(([A-Fa-f\d]{2}[:-]?){5}[A-Fa-f\d]{2})")
>
> Thanks and sorry as I'm new to django and find it hard to find help.
> Cheers
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.