字符串
字符串相加
what_he_does=' plays '
his_instrument='guitar'
his_name='Robert Johnson'
artist_intro=his_name+what_he_does+his_instrument
print(artist_intro)
字符串相乘
num=3
string='name'*num
print(string)
字符串替换
replace函数:string=string.replace(string[ : ],“word”)
format函数:“hello { } world”.format(“the”)
函数
函数创建
def function(arg1,arg2):
return "something"
函数调用
def function(arg1,arg2):
arg1=arg2
return arg1
a=12
b=25
c=function(a,b)
print(c)