简体   繁体   English

当我使用 repr function 它不工作

[英]when I use the repr function it is not working

I am trying to remove the ' ' in my list by using the repr function but it is not removing the ' '我正在尝试使用 repr function 删除列表中的“”,但它没有删除“”

code: output: output代码:output: output

input输入

The quotes mean that those are strings, not integers.引号意味着那些是字符串,而不是整数。 If you want them to be integers, you have to convert them:如果您希望它们是整数,则必须转换它们:

mylist = list(map(int,mylist))

I would also point out that repr is not intended to be final output. It's used for debugging and intermediate results.我还要指出, repr并不是最终的 output。它用于调试和中间结果。 If you need a specific format, then YOU need to build the specific format you want.如果您需要特定格式,那么您需要构建您想要的特定格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM