私は binnaries のバージョンを比較する必要があるスクリプトを書いています。たとえば、 10.1.30 よりも大きい 10.2.3 を取得する必要があります。ドットを削除すると、1023 と 10130 になり、比較結果が逆になります。
10.2.3 > 10.1.30 == 1023 !> 10130
今まで、私が出てきた唯一の解決策は次のとおりです。
1. do split(".") on version number
2. for each elemet of list i got, check if len() is eq 1 , add one zero from the left.
3. glue all elements together and get int (10.1.30 will became 100130).
4. process second version number same way and compare both as regular ints.
こちらです :
10.2.3 > 10.1.30 == 100203 > 100130
これがバージョンを比較する唯一の方法ですか、それとも他の方法がありますか?