Re: Parsing sizes

2006-02-01 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > I want to be able to parse sizes in bytes in several formats, such as > "1048576", "1024K", "1024KB", "1M" etc. > > Is there a module that will help me with that? > > /David > Like this? import re units = {'B':0, 'k':10,'M':20,'G':30,'T':40} def parse(text):

Parsing sizes

2006-02-01 Thread [EMAIL PROTECTED]
I want to be able to parse sizes in bytes in several formats, such as "1048576", "1024K", "1024KB", "1M" etc. Is there a module that will help me with that? /David -- http://mail.python.org/mailman/listinfo/python-list