str()

Convetring object to string.
str(object,encode='utf-8',errors='strict')
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 = "plus2net.com"
# encoding 'utf-8'
my_bytes = bytes(my_str, 'utf-8')
print(my_bytes) #  b'plus2net.com'
print(type(my_bytes)) #  <class 'bytes'>
print(str(my_bytes, encoding='ascii', errors='ignore'))# plus2net.com

Data type of string object

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


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    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 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer