MCPcopy
hub / github.com/InstaPy/InstaPy / format_number

Function format_number

instapy/util.py:1122–1139  ·  view source on GitHub ↗

Format number. Remove the unused comma. Replace the concatenation with relevant zeros. Remove the dot. :param number: str :return: int

(number)

Source from the content-addressed store, hash-verified

1120
1121
1122def format_number(number):
1123 """
1124 Format number. Remove the unused comma. Replace the concatenation with
1125 relevant zeros. Remove the dot.
1126
1127 :param number: str
1128
1129 :return: int
1130 """
1131 formatted_num = number.replace(",", "")
1132 formatted_num = re.sub(
1133 r"(k)$", "00" if "." in formatted_num else "000", formatted_num
1134 )
1135 formatted_num = re.sub(
1136 r"(m)$", "00000" if "." in formatted_num else "000000", formatted_num
1137 )
1138 formatted_num = formatted_num.replace(".", "")
1139 return int(formatted_num)
1140
1141
1142def username_url_to_username(username_url):

Callers 5

get_given_user_followingFunction · 0.85
get_active_usersFunction · 0.85
get_relationship_countsFunction · 0.85
find_user_idFunction · 0.85
get_links_for_tagFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected