Convetring object to string.
object : ( Required ) The object which is to be coverted to string
encode : ( Optional ) default is 'utf-8'
errors : ( Optional ) what to do if error occurs.
print(str(3.4)) #  3.4
Using type
print(type(str(3.4))) #  <class 'str'>
Using bytes
my_str = ""
# encoding 'utf-8'
my_bytes = bytes(my_str, 'utf-8')
print(my_bytes) #  b''
print(type(my_bytes)) #  <class 'bytes'>
print(str(my_bytes, encoding='ascii', errors='ignore'))#

Data type of string object

We used type() to get data type of any string object.
print(type(my_str)) # <class 'str'>
All Built in Functions in Python repr()

Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer