Python Forum
converting data sizes like: 4k, 32k, 4m, 16m, 1g, etc
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
converting data sizes like: 4k, 32k, 4m, 16m, 1g, etc
#1
i'm getting a string with a data size expressed in it like "4k", "32k", "4m", "16m", "1g". is there a Python library function that will do the conversion and give me the size as an int? support for size expressions like "3.5k" would be a plus.

edit:

i do want higher scale suffixes, too, as well as no suffix simple conversion.

edit2:

suffixes should be powers of 1024.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
with no answer and being unable to find one, i implemented my own which you can see here.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create a table with different sizes of columns in MS word pepe 8 1,413 Dec-08-2023, 07:31 PM
Last Post: Pedroski55
  Printing effect sizes for variables in an anova eyavuz21 2 939 Feb-01-2023, 02:12 PM
Last Post: eyavuz21
  Output difference from 2 lists of different sizes with words gracenz 5 1,232 Sep-02-2022, 05:09 PM
Last Post: Larz60+
  Converting data object mbrown009 5 2,717 May-30-2021, 11:35 PM
Last Post: mbrown009
  Converting data in CSV and TXT to dictionary kam_uk 3 1,950 Dec-22-2020, 08:43 PM
Last Post: bowlofred
  Converting query string as a condition for filter data. shah_entrance 1 1,750 Jan-14-2020, 09:22 AM
Last Post: perfringo
  How to format text to modify itself for different console sizes. FWendeburg 0 1,569 Feb-18-2019, 06:43 PM
Last Post: FWendeburg
  Converting raw data into panel data jason413 1 2,419 May-25-2018, 06:10 PM
Last Post: Larz60+
  Convert file sizes: will this produce accurate results? RickyWilson 2 7,989 Dec-04-2017, 03:36 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020