九州体育网 - 十年信誉网站

关于作者

Discuss / Python / 有点忘了呢

有点忘了呢

Topic source

嘻嘻哈哈12345666

#1 Created at ...

-- coding: utf-8 --

def trim(s): while s[:1]==' ': s = trim(s[1:]) while s[-1:]==' ': s = trim(s[:-1]) return s

C:\Users\Queen\Desktop\di>python Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

from new import trim trim(' hello') 'hello' trim(' hello') 'hello'

晚起的虫子不被吃1

#2 Created at ...

厉害。。。递归这就用上了。。。。。。


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.