Created
January 15, 2017 23:09
-
-
Save joshland/4058c6320db0cf966af2f7e0edd6e5e1 to your computer and use it in GitHub Desktop.
DoS your computer, using only Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convertSize(size): | |
''' | |
reduce xxxK, xxxM, xxxG, etc | |
''' | |
if size.strip() == "": | |
size = 0 | |
elif size[-1] == 'K': | |
size = size*1024 | |
elif size[-1] == 'M': | |
size = size*1024*1024 | |
elif size[-1] == 'G': | |
size = size*1024*1024*1024 | |
elif size[-1] == 'T': | |
size = size*1024*1024*1024*1024 | |
pass | |
return size | |
if __name__ == "__main__": | |
convertSize("500G") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment