-2
16進文字列をint型に変換したいが、値は変更しない。16進文字列を変換せずにPythonでint型にキャストする方法
>>> int_value = 0xb19bc74cf4
>>> print type(int_value)
<type 'int'>
例えば
今、私は今int_valueするstr_valueを変換するにはどうすればよいの文字列
>>> str_value = "0xb19bc74cf4"
>>> print type(str_value)
<type 'str'>
がありますか?
目標値結果は次のようになります。
input: str_value = "0xb19bc74cf4"
Output: int_value = 0xb19bc74cf4
Print of int_value to be 0xb19bc74cf4
print of type(int_value) to be <type 'int'>
どのように? – kuro
「変換なし」と「値を変更しない」とはどういう意味ですか? –
それは正しいです@StefanPochmann - 私はそれが数値で変換されることを望んでいません、それは16進値としてではなくタイプintとして残る必要があります。 –