Python String Remove Last n Characters

Опубликовано: 28 August 2018
на канале: Softhints - Python, Linux, Pandas
5,189
35

Python String Remove last several letters

https://blog.softhints.com/python-str...

In Python last characters of a string can be removed with indexes like:

Example Remove last n characters

n = 5
'Python is cool'[:-n]
print('Python is cool'[:-n])

Example Remove n-th characters

n = 1
print('Python'[:n] + 'Python'[n+1:])


Example Remove n-th sequence

n = 1
m = 3
print('Python'[:n] + 'Python'[n+m:])


---------------------------------------------------------------------------------------------------------------------------------------------------------------
Code store

https://bitbucket.org/softhints/

Socials

Facebook:   / 435421910242028  
Facebook:   / softhints  
Twitter:   / softwarehints  
Discord:   / discord  


If you really find this channel useful and enjoy the content, you're welcome to support me and this channel with a small donation via PayPal.

PayPal donation https://www.paypal.me/fantasyan


На этой странице сайта вы можете посмотреть видео онлайн Python String Remove Last n Characters длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Softhints - Python, Linux, Pandas 28 August 2018, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 5,189 раз и оно понравилось 35 зрителям. Приятного просмотра!