Strings in Python

 st="THis is a lorem   text"

print(len(st))

print(st)

print(st[-7:-1])

print(st.strip())

li=st.split(" ")

print(li)

print(st.upper())

print(st.lower())

age=22

# s="This is another string"+age #This throws an error

s=f"This is another string with age as {age} "

c=s+st

print(c)

Comments

Popular posts from this blog

Requests and Urllib

Strings in C Language

Dictionary in Python