Base

Stella981
• 阅读 560

Base-converter-从一个数字基转换成另一个基的代码-Henri GASC

发布:2020-12-22 19:55:59.847257

作者:Henri GASC

### 作者邮箱:henri.gasc31@gmail.com

### 首页:https://github.com/Leoriem-code/Numerical-base-converter

### 文档:None

### 下载链接 

# Numerical-base-converter

This package is to convert a value from a numerical base to another. It can work with python >= 3.0 and was created under python 3.8.5

Here is the GitHub link: https://github.com/Leoriem-code/Numerical-base-converter

The 'base' function use the 'convert' function to convert the numbers given (as a string). If a list/tuple is provided, the function will do all the string in the list/tuple. If all the numbers in the are not to be converted with the same base, please provided these values in a list following this: base([n_1, n_2, ..., [n_x, new_w_1, new_t_1], n_x+1, ..., [n_z, new_w_2, new_t_2]], base_written_in, base_to_write_to)

Here, 'base_written_in' and 'base_to_write_to' are the main base in wich we have to write in and, 'n_1', 'n_2', 'n_x', 'n_x+1' and 'n_z' are numbers we want to convert. However, the difference lay in the base in wich we want to write them. 'n_x' and all the numbers that follow will be considered written in base 'new_w_1'. They also will be written in base 'new_t_1' until say otherwise (like with [n_z, new_w_2, new_t_2])

So a lengthy explanation to say that in the example: /!\ /!\ read carefully /!\ /!\ base(['0', '1', ['2', 10, 2], '3', ['4', 10, 3], '5', '6'], 2, 10)

    0 and 1 are considered written in base 2 and will be output in base 10. So the output will be ['0', '1']
    2 is written in base 10 and will be output in base 2, output: '10'
    3 will be considered like 2 (because we have not asked to change the values of the base), output: '11'
    4, 5 and 6 are written in base 10 and will be written in base 3, output: ['11', '12', '20']





 Copy from pypi.org

查询时间:4.992ms

渲染时间:5.11ms

本文同步分享在 博客“zhenruyan”(other)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Java修道之路,问鼎巅峰,我辈代码修仙法力齐天
<center<fontcolor00FF7Fsize5face"黑体"代码尽头谁为峰,一见秃头道成空。</font<center<fontcolor00FF00size5face"黑体"编程修真路破折,一步一劫渡飞升。</font众所周知,编程修真有八大境界:1.Javase练气筑基2.数据库结丹3.web前端元婴4.Jav
Wesley13 Wesley13
2年前
4cast
4castpackageloadcsv.KumarAwanish发布:2020122117:43:04.501348作者:KumarAwanish作者邮箱:awanish00@gmail.com首页:
可莉 可莉
2年前
2021 最顶级 React 组件库推荐
点上方蓝字关注公众号「前端从进阶到入院」作者丨MaxRozen译者丨王强策划丨小智AntDesign!(https://oscimg.oschina.net/oscnet/a85c35f23bd04e5da6a1e5e68a24119b.png)项目链接:AntDesignh
Wesley13 Wesley13
2年前
CSS 奇思妙想:超级酷炫的边框动画
点上方蓝字关注公众号「前端从进阶到入院」精选原创好文助你进入大厂文章转载自公众号「iCSS前端趣闻」今天逛博客网站shoptalkshow\1\,看到这样一个界面,非常有意思:!(https://oscimg.oschina.net/oscnet/9655b35af5a045999ff55c144a3f7c
Stella981 Stella981
2年前
Arsla
Arsla用数字进行基本计算NitinGupta发布:2020122217:39:14.020812作者:NitinGupta作者邮箱:nitingpt000@gmail.com首页:https://datosb
Wesley13 Wesley13
2年前
C++多态学习之向下强制类型转换
向下强制类型转换在C中,基类(父类)指针可以指向派生类(子类)对象,因为派生类对象也是一个基类对象(但反过来不一样,基类对象不是一个派生类对象)。然而基类指针只能调用基类的成员函数,如果试图使用该指针调用仅在派生类中含有的成员函数(子类特有的,不是继承和重写父类的函数),将会产生编译错误。为了避免这一错误,就必须将基类指针转换成为派
Wesley13 Wesley13
2年前
ES6 新增的数组的方法
给定一个数组letlist\//wu:武力zhi:智力{id:1,name:'张飞',wu:97,zhi:10},{id:2,name:'诸葛亮',wu:55,zhi:99},{id:3,name:'赵云',wu:97,zhi:66},{id:4,na
为什么mysql不推荐使用雪花ID作为主键
作者:毛辰飞背景在mysql中设计表的时候,mysql官方推荐不要使用uuid或者不连续不重复的雪花id(long形且唯一),而是推荐连续自增的主键id,官方的推荐是auto_increment,那么为什么不建议采用uuid,使用uuid究
小万哥 小万哥
2个月前
C# 继承、多态性、抽象和接口详解:从入门到精通
C继承在C中,可以将字段和方法从一个类继承到另一个类。我们将“继承概念”分为两类:派生类(子类)从另一个类继承的类基类(父类)被继承的类要从一个类继承,使用:符号。在以下示例中,Car类(子类)继承了Vehicle类(父类)的字段和方法:示例csharpc