課程
/后端開發
/Python
/初識Python
感覺可以運行成功,但哪里錯了?
2018-03-24
源自:初識Python 8-3
正在回答
字符串不像List可以直接改變原內容,s[0]應該只是提取出單個字符出來而沒有改變s的功能
def firstCharUpper(s):
? ? s=s[:1].upper()+s[1:]
? ? return s
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
參考:https://www.cnblogs.com/huangbiquan/p/7783057.html
MKSS 提問者
看下是哪個小節?同意 1
舉報
學python入門視頻教程,讓你快速入門并能編寫簡單的Python程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-03-24
字符串不像List可以直接改變原內容,s[0]應該只是提取出單個字符出來而沒有改變s的功能
def firstCharUpper(s):
? ? s=s[:1].upper()+s[1:]
? ? return s
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
參考:https://www.cnblogs.com/huangbiquan/p/7783057.html
2022-03-23
看下是哪個小節?同意 1