Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Update python-stuff.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mendax1234 committed Sep 20, 2023
1 parent fbf9863 commit 7c6c5d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/blog/posts/python-stuff.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ In Python, we can either use `[]` or `list()` to create a list.
``` py
myList = ["hello", "world", "123"]
myList = list("hello world 123")
# ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', ' ', '1', '2',
# '3']
```
Remeber that in the previous [String part](#string), I have introduced the use
of `.spilt()` method. In fact, `.spilt()` method can also be used to create a
list. You can go back to review [that](#split)!

**Similarities between String and List**

Expand Down Expand Up @@ -401,6 +406,7 @@ use`""`.
myList = [1, 2, 3]
myList.insert(1, 4) # [1, 4, 2, 3]
myList.insert(-1, 4) # [1, 4, 2, 4, 3]
# insert before the index of the original element
```

- **Remove**
Expand Down

0 comments on commit 7c6c5d5

Please sign in to comment.