Python Forum
Changing a character in a string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing a character in a string
#1
Hello fellas! first time here.
i have the following string:
"ATCGATCGATCGATCGACTGACTAGTCATAGCTATGCATGTAGCTACTCGATCGATCGATCGACGATCGATATCGATGCATCGACTACTAT"

i want to write a command which will replace all of the "T" characters into "U" characters, and which the new "U" characters will be in the exact same location as the old "T" characters were.

like so:

"AUCGAUCGAUCGAUCGACUGACUAGUCAUAGCUAUGCAUGUAGCUACUCGAUCGAUCGAUCGACGAUCGAUAUCGAUGCAUCGACUACUAU"

do you have any idea how can i write such a command?

Thanks and have a great day
Reply


Messages In This Thread
Changing a character in a string - by Livne_ye - Mar-12-2019, 09:46 PM
RE: Changing a character in a string - by Larz60+ - Mar-12-2019, 09:54 PM
RE: Changing a character in a string - by Livne_ye - Mar-13-2019, 09:08 AM
RE: Changing a character in a string - by hshivaraj - Mar-12-2019, 10:33 PM
RE: Changing a character in a string - by Larz60+ - Mar-13-2019, 12:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Virtual Env changing mysql connection string in python Fredesetes 0 378 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,377 Sep-27-2022, 01:38 PM
Last Post: buran
  Changing a string value to a numerical value using python code and a lamda function Led_Zeppelin 6 1,610 Jul-05-2022, 11:29 PM
Last Post: deanhystad
Thumbs Up Parsing a YAML file without changing the string content..?, Flask - solved. SpongeB0B 2 2,275 Aug-05-2021, 08:02 AM
Last Post: SpongeB0B
  Regex: a string does not starts and ends with the same character Melcu54 5 2,424 Jul-04-2021, 07:51 PM
Last Post: Melcu54
  [solved] unexpected character after line continuation character paul18fr 4 3,405 Jun-22-2021, 03:22 PM
Last Post: deanhystad
  SyntaxError: unexpected character after line continuation character siteshkumar 2 3,181 Jul-13-2020, 07:05 PM
Last Post: snippsat
  Remove from end of string up to and including some character lbtdne 2 2,337 May-17-2020, 09:24 AM
Last Post: menator01
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 2,741 Jan-05-2020, 11:50 AM
Last Post: vivekagrey
  How to get the index of a character from a string chihaya 1 2,169 Dec-03-2019, 12:54 PM
Last Post: buran

Forum Jump:

User Panel Messages

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