Home  >  Article  >  Backend Development  >  Strings in python programming

Strings in python programming

王林
王林Original
2024-09-06 06:01:36910browse

Strings in python programming

string in programming
a="Hello"
b="Avinash"
print(a,b)
a="My name is Avinash"
print(a)
a="""My name is Avinash.I am come to keeramangalam,str(age(19)"""
print(a)
a="Avinash"
print(a[4])
a="Avinash"
print(len(a))
txt="The best beauitiful in india"
print("India" in txt)

modify string

a="Hello world"
print(a.upper())

lower case

a="Hello world"
print(a.lower())

replace string

a="Helllo world"
print(a.replace("h","r"))

strip string

a="Hello world"
print(a.strip())

string concentrated

a="Hello"
b="Avinash"
c=(a+b)
print(c)

add two values

a="Hello"
b="world"
print(a+""+b)
age=10
txt=f"My name is Avinash,Iam{age}"
print(txt)

o/p
Hello Avinash
My name is Avinash
My name is Avinash.I am come to keeramangalam,str(age(19)
a
7
False
HELLO WORLD
hello world
Helllo world
Hello world
HelloAvinash
Helloworld
My name is Avinash,Iam10

The above is the detailed content of Strings in python programming. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn