Python Forum

Full Version: Please explain how to alter text with python code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
# Complete the following remove_dollar function
# so that it removes any dollar signs and spaces
# and then returns the string as a number (float).
def remove_dollar(s):



csv file data is :
LastSpend Spend
$144.5 $596
4502.2 $761.6
What have you tried? We're not big on writing code for people here, but we would be happy to help you fix your code when you run into problems. When you do run into problems, please post your code in Python tags, and clearly explain the problem you are having, including the full text of any errors.
# Complete the following remove_dollar function 
# so that it removes any dollar signs and spaces
# and then returns the string as a number (float).
def remove_dollar(s):
csv file data is :
Output:
LastSpend Spend $144.5 $596 4502.2 $761.6
how can we write a program that removes $ from the column values i.e. LastSpend and Spend
By showing some effort. You have done nothing but post your homework assignment. We're not doing your homework for you. Again, make an actual attempt to write the code, tell us how it doesn't work, and we'll help you.