python: how to convert currency to decimal? -


i have dollars in string variable

dollars = '$5.99' 

how convert decimal instead of string can operations adding dollars it?

there's easy approach:

dollar_dec = float(dollars[1:]) 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -