Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert the radix of python integers

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article Xiaobian for you to introduce in detail the "python integer base how to convert", the content is detailed, the steps are clear, the details are handled properly, I hope this "python integer base how to convert" article can help you solve doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.

1. The oct function converts decimal numbers into octal numbers, the hex function converts decimal numbers into hexadecimal numbers, and bin converts decimal numbers into binary numbers. Another built-in int function converts the string of a number to an integer and determines the base of the number based on its second argument.

> > int ('64'), int (' 100Paijingpai8), int ('40Fengjie 16), int (' 1000000FL2) (64pr 64) > int ('0x40Fei 16), int (' 0b1000000LL2) # Literals okay too (64p64)

2. Use string formatted method calls to convert integers to octal and hexadecimal numbers.

>'{0 O}, {1 x}, {2PD b} '.format (64mem64)' 100meme 40pm 1000000'> >'% o meme% x'% X'% (64255255) '100meme FF', this article "how to convert python integers" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it. If you want to know more about it, you need to know more about it. Welcome to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report