Remove $ from a column of salaries python 3

前端 未结 1 1513
无人及你
无人及你 2021-01-26 20:40

I am trying to print the min and max from a list of salaries that I am reading from a csv file, but first I must remove the $ from the value and don\'t know how.

I tried

相关标签:
1条回答
  • 2021-01-26 21:03

    Hard to know the exact problem without the code, but you could try one of these:

    new_salary = [s.replace("$", "") for s in salary]
    

    or:

    new_salary = [s[1:] for s in salary]
    
    0 讨论(0)
提交回复
热议问题