P
P
Python Newbie2021-08-09 22:37:46
Python
Python Newbie, 2021-08-09 22:37:46

How to remove specific text from a variable in python?

Hello I

have a code:

#есть текст
text = ("hello world")

#как мне сделать чтобы из этого текста удалилось слово hello?

print(text)


How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Python Newbie, 2021-08-09
@Levman5

text = "hello world"
text = text.replace('hello', '') #1параметр слово для заменя, втрой слово кторым заменьтяся
print(text)

A
Alexander, 2021-08-09
@avorsa

fishing rod here
catch fish yourself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question