- 1

python program .. give your answer Input: 23dsa43dsa98 : Output: 23,43,98

which function used to this?

3rd Apr 2019, 1:31 AM
Saranraj C
Saranraj C - avatar
4 Respuestas
+ 3
... I think they want numbers in an input string be extracted to a list of something. Still, missing attempt by the OP. You can actually use regex to replace non-numeric groups to a whitespace, and use split to split by whitespace to a list, if that is the case.
3rd Apr 2019, 1:52 AM
Fermi
Fermi - avatar
+ 3
hi SARANRAJ, function is replace(). See code sample: test = '23dsa43dsa98' out = test.replace('dsa',',') print(out) print(test.replace('dsa', ',')) ''' output is: 23,43,98 23,43,98 ''' I used 2 versions: creating a new string with replace and printing direct with replace.
3rd Apr 2019, 8:59 AM
Lothar
Lothar - avatar
+ 3
print(*re.findall("\d+", input()), sep=",")
4th Apr 2019, 1:45 AM
Flandre Scarlet
Flandre Scarlet - avatar