Toggle navigation
English
Chinese
Python Sandbox
Please refer to
this tutorial
to find more details on the following codes.
# Python String is a List line="Welcome to the class" print(line[10]) print(line[1:9]) print(line[::-1]) # Functions - toupper(), tolower() line="A to Z" print(toupper(line)) print(tolower(line)) # Function - strip() line=f.readline() l=line.strip() print(line) print(l) # Function - find() mystring="ATGCAAATGCAT" print(mystring.find("AAA")) # Function - replace() mystring="ATGCAAATGCAT" new=mystring.replace("A","T") print(new) mystring="John, Jane, Jill, Juan, Jedi" new = mystring.replace(",","") print(new) # Function - split() line="A big fat hen" x=line.split() for w in x: print(w) # Function - join() x=["ATGC", "TGGG", "TAAA"] y="ATGCTGGGTAAA" z= "".join(x) if(z==y): print("YES")
Run
List