Вот очень основной пример: < /p>
Код: Выделить всё
s1 = 'name/with/slashes'
s2 = 'name '
def clean(s):
s = s.replace('/', '')
s = s.strip()
return s
# the _ is there so I can see the end of the string
print clean(s1) + '_'
Каким будет питонический способ сделать это?
Подробнее здесь: https://stackoverflow.com/questions/330 ... -in-python
Мобильная версия