Найти - Пользователи
Полная версия: list.clear для 2.7?
Начало » Python для новичков » list.clear для 2.7?
1
ss100s
python 2 не поддерживает list.clear().
Чем можно заменить?
py.user.next
  
>>> lst = [1, 2, 3]
>>> id(lst)
139771908863688
>>> 
>>> lst[:] = []
>>> id(lst)
139771908863688
>>> lst
[]
>>>

Не припомню, чтобы нужен был этот метод когда-либо.
  
>>> lst = [1, 2, 3]
>>> lst
[1, 2, 3]
>>> lst = []
>>> lst
[]
>>>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB