I am new to python programming language I basically come from c language background. I am having a problem while working with python strings. Anyway, in my program, I have got a situation where I need to convert a float into a python string. For example, if the user input is:
Is it possible to convert the float to string I am really confused about it waiting for some help as soon as possible this is getting me in a bit of trouble?
Python string has a built-in function named Str( ) method. The string method is used to convert the float point number to the string and use them wherever necessary. The built-in method returns a string of the words, using the “delimiter” as the delimiter string. But you have to keep in mind that internal it should be floating point number only still any data structure can be converted to the string. As per your requirement, you want to do this:
is_a_str = str(float)
flt = 123.45
You can even check the type of this new float converted to string with the help of type( ) function present in it, I hope this is going to help you. Happy coding!!