Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting string to short in python

Generally there is a parallel between Java and Python in how strings are converted to numbers

int x = Integer.parseInt(a, 2); //java
x = int(a,2) # python

But it does not seem to work for short

short x = Short.parseShort(a, 2); //java
x = short(a,2) # does not work in python

Does anyone know how to get short to work?

like image 499
learner Avatar asked Apr 26 '26 15:04

learner


1 Answers

There is no short data type in Python. Just use int.

like image 118
NPE Avatar answered Apr 28 '26 05:04

NPE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!