Python 输出时去掉列表元组外面的方括号与圆括号的方法
作者:wxy_csdn_world 时间:2023-06-06 07:10:44
在这可以用join()函数
'x'.join(y),x可以是任意分割字符,y是列表或元组。以列表为例,可以将列表中的每一个元素两头的引号给去除,同时,元素与元素之间以字符‘x'作为分割标志,并且列表最外面的中括号也能去除掉。元组同理。
a_list=['monday','tuesday','wednesday','thursday','friday','saturday','sunday']
print(' '.join(a_list))
print("\r")
b_tuple=('monday','tuesday','wednesday','thursday','friday','saturday','sunday')
print(' '.join(b_tuple))
来源:https://blog.csdn.net/wxy_csdn_world/article/details/80746870
标签:Python,列表元组,方括号,圆括号
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python OpenCV去除字母后面的杂线操作
2023-08-02 15:18:47
![](https://img.aspxhome.com/file/2023/7/60947_0s.jpg)
对YOLOv3模型调用时候的python接口详解
2023-05-31 00:58:57
![](https://img.aspxhome.com/file/2023/3/93513_0s.jpg)
Python参数解析模块sys、getopt、argparse使用与对比分析
2021-12-19 17:39:58
![](https://img.aspxhome.com/file/2023/1/80781_0s.png)
Python计算一个文件里字数的方法
2022-09-23 10:28:19
JavaScript快速实现一个颜色选择器
2024-04-28 09:38:09
![](https://img.aspxhome.com/file/2023/1/132851_0s.jpg)
Oracle客户端 NLS_LANG 的设置方法
2012-07-11 15:55:27
如何解决django-celery启动后迅速关闭
2022-02-07 10:50:25
一文带你了解Python中的字符串是什么
2021-10-16 06:05:27
![](https://img.aspxhome.com/file/2023/7/88987_0s.png)
python 七种邮件内容发送方法实例
2022-01-13 21:06:38
python使用matplotlib绘图时图例显示问题的解决
2022-11-13 16:59:47
![](https://img.aspxhome.com/file/2023/8/62898_0s.jpg)
Pytest allure 命令行参数的使用
2022-04-12 17:06:19
![](https://img.aspxhome.com/file/2023/6/97696_0s.png)
Python实现多张图片合成文字的效果
2021-02-16 17:12:12
![](https://img.aspxhome.com/file/2023/5/115055_0s.jpg)
python Opencv实现停车位识别思路详解
2023-10-20 21:54:25
![](https://img.aspxhome.com/file/2023/5/86225_0s.jpg)
清理Mysql general_log的方法总结
2024-01-14 10:54:34
JavaScript中实现字符串的取左取右(实现left和right功能)
2009-07-20 12:39:00
thinkphp利用模型通用数据编辑添加和删除的实例代码
2024-05-03 15:13:14
sql2000各个版本区别总结第1/3页
2024-01-15 10:09:42
python版本单链表实现代码
2022-12-06 16:49:26
原生JavaScript实现网页版计算器
2024-04-23 09:27:08
![](https://img.aspxhome.com/file/2023/4/135524_0s.jpg)
win10环境下使用Hyper-V进行虚拟机创建的教程(图解)
2022-08-01 02:25:06
![](https://img.aspxhome.com/file/2023/5/131875_0s.jpg)