Regular Expressions
Steve Juranich
sjuranic at gmail.com
Wed Apr 12 15:37:22 EDT 2006
david brochu jr wrote:
> Hi,
>
> I am trying to grab the following string out of a text file using regular
> expression (re module):
>
> "DcaVer"=dword:00000640
>
> What I need to do with that string is trim down " "DcaVer"=dword:" and
> convert the remaining number from hex to dec.
>
> I have been trying to figure this out for a while..I am fairly new so
> please any help would be greatly appreciated.
line = '"DcaVer"=dword:00000640'
value = int(line.split(':')[1], 16)
Note that no regexes are needed.
Cheers.
--
Steve Juranich
Tucson, AZ
USA
More information about the Python-list
mailing list