Python Forum
"replace() method" fails to change string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"replace() method" fails to change string
#1
Hi all,
New to Python and this forum so I guess i am missing something simple.
Why does this string method work in the Python shell but not when used in my PyCharm program?
Python version seems to make no difference.

import os
s = "ghghkc"
s.replace("g","#")
print (s)
Reply


Messages In This Thread
"replace() method" fails to change string - by pw928gts - Nov-30-2018, 04:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to replace a string with a file (HTML file) tester_V 1 751 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  Replace string in a nested Dictianory. SpongeB0B 2 1,183 Mar-24-2023, 05:09 PM
Last Post: SpongeB0B
  Replace with upper(string) WJSwan 7 1,559 Feb-10-2023, 10:28 AM
Last Post: WJSwan
  Find and Replace numbers in String giddyhead 2 1,218 Jul-17-2022, 06:22 PM
Last Post: giddyhead
  change string in MS word Mr_Blue 8 3,290 Sep-19-2021, 02:13 PM
Last Post: snippsat
  Replace String in multiple text-files [SOLVED] AlphaInc 5 8,077 Aug-08-2021, 04:59 PM
Last Post: Axel_Erfurt
  Replace String with increasing numer [SOLVED] AlphaInc 13 4,996 Aug-07-2021, 08:16 AM
Last Post: perfringo
  Question about change hex string to integer sting in the list (python 2.7) lzfneu 1 2,511 May-24-2021, 08:48 AM
Last Post: bowlofred
  How to replace on char with another in a string? korenron 3 2,336 Dec-03-2020, 07:37 AM
Last Post: korenron
  How can I change a string. Mike Ru 3 2,422 Jun-03-2020, 10:55 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020