a='21'
int(a)#默认是十进制
print("{},{}".format(a,type(a)))
b='21'
int(b,16)
print("{},{}".format(b,type(b)))
c=21
str(c)
print("{},{}".format(c,type(c)))d=21
hex(d)
print("{},{}".format(d,type(d)))

D:\学习\Python工程\venv\Scripts\python.exe D:/学习/Python工程/practice/test_demo.py
21,<class ‘str’>
21,<class ‘str’>
21,<class ‘int’>
21,<class ‘int’>

Process finished with exit code 0

字符串的10进制和16进制有什么区别?

python21天打卡Day8-string,int互转相关推荐

  1. python21天打卡Day10-string和bytes互转

    a='21 python' b=a.encode('utf-8')#string转为bytes print('{},{}'.format(b,type(b))) c=b'21 python' d=c. ...

  2. Go语言常见类型转换(int、int32,int64,float32、float64与string类型互转)

    int与string int转string str = strconv.Itoa(i.(int)) string转int num,err = strconv.Atoi(i.(string)) int3 ...

  3. java 使用json-lib 对象,String,json互转

    所使用的包: commons-beanutils.jar commons-collections-3.1.jar commons-lang.jar commons-logging-1.1.3.jar ...

  4. ipv4和ipv6与int互转通用处理方式

    记录一下ipv4和ipv6与int互转通用处理方式,由于ipv6转的int比较大,因此需要使用big.Int来保存 package mainimport ("fmt""m ...

  5. The constructor JedisPool(GenericObjectPoolConfig, String, int, int, String) refers to the missing t

    想学习学习redis缓存技术,于是到网上copy到了一些代码,粘贴到ecplise上面,但是发现代码总是报错 The constructor JedisPool(GenericObjectPoolCo ...

  6. java中String,int,Integer,char、double类型转换

    java中String,int,Integer,char.double类型转换----https://www.cnblogs.com/kangyu222/p/5866025.html 转载于:http ...

  7. 如何解决提示the operation % is undefined for the argument type string,int的错误

    今天在做一个用三元运算符判断奇偶的小练习时遇到"the operation % is undefined for the argument type string,int"错误的小 ...

  8. java bean转string_Json、JavaBean、String等互转

    Json.JavaBean.String等互转 本文介绍简单的Json.JavaBean.String互换(下文JavaBean简称Object对象,这里不是很严谨) 转换关系如下: 其中String ...

  9. String int之间转换

    String int之间转换

最新文章

  1. 配置伪静态(URL重写)
  2. Linux常用的基本命令head、tail、tar、grep、date、cal(二)
  3. 如何取得Win7文件的管理员权限?
  4. CompletableFuture详解~thenAcceptAsync
  5. 企业开发需要的git提交和拉取代码(本地仓库和github演示)
  6. Java中JDK安装以及环境变量设置
  7. struts2+json(3)
  8. Web Storage 与cookies
  9. VR AR体验或成2017圣丹斯电影节“新主角”
  10. Fiddler模拟请求报文
  11. MySQL独立表空间、共享表空间
  12. java语言有哪些优点
  13. 水电缴费系统php源码_水电缴费管理系统(示例代码)
  14. 张正友标定算法原理详解(一)
  15. springboot集成socket.io通过jwt-token身份认证鉴权
  16. 云计算之云计算和虚拟化的区别
  17. 怎么用计算机算组合数c,排列组合c怎么算 公式是什么
  18. Python编程:根据经纬度生成并调用地图
  19. wordpress 漂亮的Cosy主题
  20. 微软混合现实设备HoloLens 2惊艳发布,售价2.4万人民币

热门文章

  1. 【免费毕设】成绩查询系统(系统+论文+答辩PPT)
  2. mqttfx连接emq_云服务器上MQTT:EMQ服务搭建使用教程
  3. python字典示例简单代码_python学习笔记:字典的使用示例详解
  4. 服务器网络销售软文,关于云服务器的软文
  5. python流程图可以用吗_有什么办法可以将Python代码直接转换成流程图吗?
  6. HALCON 21.11:深度学习笔记---对象检测, 实例分割(11)
  7. Python: 函数参数传递机制
  8. Python:PyCharm提示“Python version 2.7 does not support a ‘F‘ prefix”
  9. OSChina 周五乱弹 —— 如何向妹子解释越位
  10. 如何使用 Buildah 构建容器镜像