Python字符串格式化
2015-06-14 16:25
615 查看
In [1]: "%(name)s is %(age)s" % {"name":"bob", "age": 12} Out[1]: 'bob is 12' In [2]: "%s is %s" % ("bob", "13") Out[2]: 'bob is 13' In [6]: "{0} is {1}".format("bob", "14") Out[6]: 'bob is 14' In [7]: "{name} is {age}".format(name="bob",age="15") Out[7]: 'bob is 15'
相关文章推荐
- Python中文字符串截取
- python chardet简单应用
- Python time datetime常用时间处理方法
- Python 拷贝对象(深拷贝deepcopy与浅拷贝copy)
- python开发微信公众平台 BAE
- python中if __name = '__main__',#!/usr/bin/python 解析
- Python抓取给定URL网页里的图片
- Scrapy练习爬知乎第一辑
- 我为什么从 Python 转向 Go?
- Django数据库操作(python)
- Python之PyQT4的使用技巧集锦
- Simulate Blackjack Game - Card Generator
- Simulate Blackjack Game - Card Generator
- 搭建VTK+ITK+Python系统
- Python遍历文件夹,删除空文件夹,过滤特定大小和格式的文件
- 人人都懂的编程课(Python)
- 人人都懂的编程课(Python)
- Python 各种IDE比较
- python RSA签名
- leetcode Excel Sheet Column Number python