SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
>>> %Run -c $EDITOR_CONTENT
['Red', 'Orange', 'Blue', 'Green']
Remove List Items
The remove() method removes the specified item.
C_list
=
[
"Red"
,
"Blue"
,
"Green"
]
C_list
.
remove(
"Blue"
)
(C_list)
>>> %Run -c $EDITOR_CONTENT
['Red', 'Green']
The pop() method removes the specified index. If you do not specify the index, the pop() method removes the last
item.
A_list
=
[
"Banana"
,
255
,
False
,
3.14
,
True
,
"Orange"
]
A_list
.
pop(
1
)
(A_list)
A_list
.
pop()
(A_list)
>>> %Run -c $EDITOR_CONTENT
255
['Banana', False, 3.14, True, 'Orange']
'Orange'
['Banana', False, 3.14, True]
The
del
keyword also removes the specified index:
C_list
=
[
"Red"
,
"Blue"
,
"Green"
]
del
C_list[
1
]
(C_list)
>>> %Run -c $EDITOR_CONTENT
['Red', 'Green']
The clear() method empties the list. The list still remains, but it has no content.
C_list
=
[
"Red"
,
"Blue"
,
"Green"
]
C_list
.
clear()
(C_list)
>>> %Run -c $EDITOR_CONTENT
[]
3.5. MicroPython Basic Syntax
135
Содержание Thales Kit
Страница 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Страница 2: ......
Страница 4: ...ii ...
Страница 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Страница 10: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 6 Chapter 1 Introduction to Raspberry Pi Pico ...
Страница 12: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 8 Chapter 2 What is Included in This Kit ...
Страница 13: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 1 Components List 2 1 Components List 9 ...
Страница 42: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 38 Chapter 2 What is Included in This Kit ...
Страница 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Страница 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...