Last active
August 18, 2021 07:57
-
-
Save U29/463235c1212f51018880b71817629fab to your computer and use it in GitHub Desktop.
半角数字を全角数字に変換する関数 (Python2.x and Python3.x)
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
# -*- coding: utf-8 -*- | |
def convert_num_half_to_full(h_num): | |
F_NUM_LIST = ["0","1", "2", "3","4", "5", "6", "7", "8", "9"] | |
f_num_str = "" | |
h_num_str = str(h_num) | |
for string in h_num_str: | |
f_num_str += F_NUM_LIST[int(string)] | |
return f_num_str | |
# Sample # | |
print(convert_num_half_to_full(3)) | |
print(convert_num_half_to_full(19)) | |
print(convert_num_half_to_full(241020)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment