[英]How to print individual values from a set in python
i have a set with the following output set(['SCD-3392', 'SCD-3547', 'SCD-3507'])我有一组具有以下输出集(['SCD-3392', 'SCD-3547', 'SCD-3507'])
I am trying to export this into a csv file.我正在尝试将其导出到 csv 文件中。 It gets printed the same way instead i want it to only display as
它以相同的方式打印,而不是我希望它只显示为
SCD-3392
SCD-3547
SCD-3507
You can try like this,你可以这样试试
>>> for item in set(['SCD-3392', 'SCD-3547', 'SCD-3507']):
... print(item)
...
SCD-3392
SCD-3547
SCD-3507
print "\n".join(set(['SCD-3392', 'SCD-3547', 'SCD-3507']))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.