python 一个元素的元组包含多余逗号
2016-03-21 14:32
417 查看
a=(1)
print a
此时a 是整数
print type(a) =int
应该使用a=(1,)
或者a=tuple(a)
因此在可变参数的函数中
def f(*arg):
print arg
f(1)
会显示 (1,) 这样的形式
print a
此时a 是整数
print type(a) =int
应该使用a=(1,)
或者a=tuple(a)
因此在可变参数的函数中
def f(*arg):
print arg
f(1)
会显示 (1,) 这样的形式
相关文章推荐
- python 线程、进程和协程
- Python~Outlook
- 等等 python 爬虫
- python命令行自动补全
- Python 基础教程
- 压力测试过程中,采集服务器性能数据
- python编码转换实验
- 参考教程,练习BeautifulSoup实例
- 为什么用Java——一个来自Python阵营的程序员告诉你
- 简明Python教程学习笔记_2_函数
- IPython
- 关于python的文件操作
- 《跟着小吴哥学python》之 03 python语法&基本类型
- 【转】python安装第三方模块
- Python 笔记1
- Python pandas plot hlines
- python的unicode处理关系
- 【搬砖】【Python数据分析】Pycharm中plot绘图不能显示出来
- python易混淆点二 函数 参数 属性
- python3.x + django1.9.4 +mysql