9 月 152020
 
#字符串赋值
word = 'a loooooong word'
#整数赋值
num = 12
#字符串赋值
string = 'bang!'
#字符串运算
total = string * (len(word) - num)
#total = 'bang!' * (len(word) - 12)
#total = 'bang!' * (16 - 12)
#len函数,计算字符串长度
print(total)
#连续四次
PS C:\Users\harveymei> & C:/Users/harveymei/AppData/Local/Programs/Python/Python38/python.exe c:/Users/harveymei/hello.py
bang!bang!bang!bang!
PS C:\Users\harveymei> 

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)