+ 4

How to remove first character from string ?

I am solving a problem so I have to remove first Character from words but I have no idea. Anyone tell me how to remove.

15th Jun 2021, 10:51 AM
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ - avatar
16 Answers
0
You can use: del a[-1]
15th Jun 2021, 11:38 AM
SammE
SammE - avatar
+ 8
Pawan Kumar x = ["aapple","bbanana","ccat","ddonkey"] y = [ i[1:] for i in x] print(y) #apple,banana,cat,donkey
15th Jun 2021, 11:41 AM
TOLUENE
TOLUENE - avatar
+ 5
I think it can be something like: a = input() print(a[1:]) Hope that's helpful!
15th Jun 2021, 10:57 AM
HNL
HNL - avatar
+ 3
a="hello" Indexing ________ print(a[0]) // 'h' Slicing _______ print(a[1:]) //"ello"
15th Jun 2021, 10:59 AM
Abhay
Abhay - avatar
+ 3
It is not possible! A string is immutable, all you can do is create another string not having first char. Choose one of the proposals given .
17th Jun 2021, 7:14 AM
Oma Falk
Oma Falk - avatar
+ 1
Use this simple code - print(str(input())[1:])
17th Jun 2021, 2:53 AM
Dondapati Eswara Satya Sai Rama Rohith
Dondapati Eswara Satya Sai Rama Rohith - avatar
0
Thanks Friends
15th Jun 2021, 12:40 PM
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ - avatar
0
Finally I have solved the problem.
15th Jun 2021, 12:41 PM
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ - avatar
- 1
a = "string" a = a[1:] print(a)
15th Jun 2021, 11:02 AM
TOLUENE
TOLUENE - avatar
- 1
a = input() r = a.replace(a[-1], '') print(r)
15th Jun 2021, 11:03 AM
SammE
SammE - avatar
- 1
Rostislav Khalilov and Md Sayed and Abhay I want to remove first character of list string. I mean a list where values are string. Ok
15th Jun 2021, 11:35 AM
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ - avatar
- 1
Ok let me try frist
15th Jun 2021, 11:39 AM
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ
๐—ฃ๐—ฎ๐˜„๐—ฎ๐—ป ๐—ž๐˜‚๐—บ๐—ฎ๐—ฟ ๐Ÿ…Ÿ๏ธŽ๐Ÿ…š๏ธŽ - avatar
- 1
Yo, just use a[0] to get the first index of a.
16th Jun 2021, 1:26 PM
Shreyaansh
Shreyaansh - avatar
- 1
You can use this method... a = "PMurad" (or any string) a = a[1:] print(a) Your output will be "Murad" (1st character removed)
16th Jun 2021, 3:38 PM
Somudro Bilas
Somudro Bilas - avatar
- 1
You can use replace() method. str = "Ahmed" NewStr= str.replace("A","") print (NewStr) Output: hmed
16th Jun 2021, 10:26 PM
Riz Ahmed
- 2
A##
17th Jun 2021, 9:25 AM
Sachin Ghemud