单选题
设str1='python',语句print(str1.center(10,*))的执行结果是()
A
pytho****
B
**python**
C
****python .
D
SyntaxError
答案解析
正确答案:D
解析:
解析: str.center(width, fillchar):返回长度为width的字符串,其中,str位于新字符串中心位置,两侧新增字符采用fillar填充。正确的语句是print(str1. center(10, '*')),运行后的结果为**python**。题面语句运行会出错。
相关知识点:
center函数用法记
