Python Tutorial 31 – Type Casting using int() float() and str()



Donate!: This video will have to do with data types. Sometimes in python we have to convert from one data type to another, we can use certain functions to help us do this!

More content:
Courses for Download:
Facebook:
Google+:
Twitter:
Subscribe (it’s free!):

Amazing Web Hosting – (The best web hosting for a cheap price!)

Nguồn: https://benjaminjcohen.com/

Xem thêm bài viết khác: https://benjaminjcohen.com/cong-nghe/

8 Comments

  1. Erro: Could not convert string to float : , How to solve this error? ,
    self.totalcp = float(self.cp * self.estoque) self.totalsp = float(self.sp * self.estoque) self.lucro = float(self.sp – self.cp)

    I'm from Brazil

  2. in(5.5)
    output 5
    THis would be an example of casting am I right?

  3. Thanks, Sir, It is really helpful.
    This video related to my written article.
    Everyone can also read more details about this lecture to click at the given link as below.
    https://www.stackoftuts.com/typecasting-in-python/

  4. Really helped with my exam revision for ICT cheers mate x

  5. @woodytoob. Here is an example of a Python cast … cast(cStringVariable,c_char_p).value.decode("ascii") which casts a C style string to a Python style string.

  6. "Casting" does not exist in Python.

Leave a Reply

Your email address will not be published. Required fields are marked *