I would like to remove the ["flow", "flappy", "flirtify"] first character from every single index in this array, but I don't know how. I tried almost everything but it still doesn't work. Any suggestions?
Asked
Active
Viewed 972 times
4 Answers
1
first_char_removed = [word[1:] for word in original_list]
In the future, I would recommend posting your code attempts

Mouse
- 395
- 1
- 7
1
to remove the first character of a string you can just use string[1:] who return you the same string without the first character.
see code example below :
for myword in myWordsArray:
print(myword[1:])

napiraz nathanix
- 11
- 3
0
[word[1:] for word in ["flow", "flappy", "flirtify"]]
you can see how to do it for a single string, and then use list comprehension

ItayB
- 10,377
- 9
- 50
- 77
0
The simplest way would probably be list comprehension
l = [e[1:] for e in ["flow", "flappy", "flirtify"]]

excepts
- 41
- 3