[英]Remove brackets and special characters from string and convert List (Values are comma separated)
[英]How do i remove special characters in output print (brackets, the (') and the comma)
我的代码:
a='hello'
b= 10
c=a, b
print (c)
output:
('hello', 10)
我想要的 output:
你好 10
基本上我想删除',()提前致谢
将print (c)
替换为print(*c)
。
有很多方法可以做到这一点,但我建议使用 f-strings 即
print(f"{a} {b}")
以下是所有方法的列表:
#Using f-strings
print(f"{a} {b}")
#List Method
print(*c)
#For Loops
for i in c:
print(i,end=" ") #MAKES NO SENSE AT ALL. But is a method.
#String Concatenation
print(a+b)
#Print Normally
print(a, b)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.