I want to cast a tuple value with comma to string in python. Ex Input: 3,500.60 and output should be 3,500.6(string type)
value=3,500.60
s=str(value)
this returns (3, 500.6)
but I want like 3,500.6
Is it possible?
I want to cast a tuple value with comma to string in python. Ex Input: 3,500.60 and output should be 3,500.6(string type)
value=3,500.60
s=str(value)
this returns (3, 500.6)
but I want like 3,500.6
Is it possible?
I asked a one liner expression which gives output like this. Anyway this one solved my problem.
value=3,500.60
b=''
for i in str(value):
if not i in (' ','(',')'):
b+=i
print(b)
UPDATE
This is what I want: Method 1:
print(str(map(lambda x:x if x not in ('(',')') else '',[i for i in value])).strip('[]').replace(' ',''))
Method 2:
print(str(value).strip('()').replace(' ',''))
All of them given result 3,500.6