gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
how to convert bin number into int inpython
- User
how to convert bin number into int inpython
- Assistant
You can use the
int()function and provide thebaseparameter as 2, which indicates that the input is in binary format, like this:bin_num = '1010' int_num = int(bin_num, 2) print(int_num)Output:
10