Answers for "how to write string in python"

15

how to create string in python

string = "this is string"
#or
string = 'this is also string'
Posted by: Guest on April-15-2020
11

strings in python

#A string is a type of data. There are many data types. It can be manipulated.
#It can be storerd as a variable
myString = "Hello world"
#WE can print it:
print(myString)
#You can append it to arraY:
myArr = []
myArr.append(myString)
#You can find the index of a character in a string:
H = myString[0]
#You can use methods on it:
lowercase = myString.lower()
#You can convert it into a integer provided it is a numerical string
myInt = int(myString)
#So thats the basics, hope i haven't left anything out.
Posted by: Guest on July-26-2020
2

define a string in python

string1 = "something"
string2 = 'something else'
string3 = """
something
super
long
"""
Posted by: Guest on December-04-2020
0

how to write string in python

#name of the variable = "string"
name = "john"
Posted by: Guest on September-08-2020

Code answers related to "how to write string in python"

Python Answers by Framework

Browse Popular Code Answers by Language