Casey Bralla via plug on 28 Jun 2023 10:47:48 -0700
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
[PLUG] Help With Python String Replacement
|
- From: Casey Bralla via plug <plug@lists.phillylinux.org>
- To: "PLUG Philadelphia Linux Users Group" <PLUG@Lists.PhillyLinux.org>
- Subject: [PLUG] Help With Python String Replacement
- Date: Wed, 28 Jun 2023 13:47:35 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=OS0E3DHj7KYPwjZpbuXR+6Bslv/EACAgrFLlm55h5rk=; h=from:subject:date:to:mime-version:content-type:content-transfer-encoding:list-unsubscribe:x-csa-complaints:list-unsubscribe-post; b=BCk/EXkY2EyJu1Z7eiC5di0EVkOMk6hMTqrgP4he1pxTM5/4RVH+wfOjISCKswaA2R1lpRXetv0I Cccn0moyy9MN5brMJ1JmbZDPKf0+fVgQ3PnEJLtBlIRHwdVPLKs/fpXFuZh82WAadGLB8rHiBXLj izAtjfBxbeni+aXhkzo=
- Feedback-id: 77.32.148.25:4536357_-1:4536357:Sendinblue
- Origin-messageid: <f939d245-691a-b153-4707-6bf5c21a4a65@NerdWorld.org>
- Reply-to: Casey Bralla <MailList@NerdWorld.org>
- Sender: "plug" <plug-bounces@lists.phillylinux.org>
- User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0
This should be a no-brainer, but I guess I fit in the category of "no
brain" :)
My python script is looking through a text file and wants to fix some
character strings that contain escape characters.
I want to replace some double-slashes "\\" with single slashes "\". I
also want to replace a slash-comma "\,"with a comma ","
But the python code is getting confused by the slashes as escape
characters. Here's my code.
StringVariable.replace("\\","\")
StringVariable.replace("\,",",")
Can somebody help me with this code snippet?
TIA!
Casey
--
LEGAL NOTICE: This eMail contains private, personal, and/or privileged
information and is only for the intended recipient(s). In fact, you
really should consider yourself honored to even be cc'd on this
tremendously important communication. The author spent literally
seconds composing this magnificent opus of rational thought and
deductive logic. Unfortunately, it has probably been based on
inaccurate data, which really stinks because this eMail would have been
truly awesome! If you have received this eMail in error, we
respectfully DEMAND that you immediately delete it and inform the sender
that you have received it in error. Then, just to be safe, you should
reformat your hard drive, shave your head, renounce all material
possessions (which are really controlling your life anyway), and join an
end-of-times cult somewhere. Once there, you must reconsider all the
terrible choices you've made in your life, and promise never to confuse
"sex" with "gender" again. Of course, this assumes you have already
come to terms with your inherent whiteness, AND that you have learned
the lyrics to The Internationale. "Arise, wretched of the earth! Arise,
convicts of hunger..."
(https://en.wikipedia.org/wiki/The_Internationale) We sincerely hope
you are able to get your medication stabilized and no longer have
that recurring dream where you're alone in a large crowd, standing
naked in a vat of chocolate Yoo-hoo. BTW, Yoo-hoo really is an
underrated beverage. It’s chocolatey, yet suprisingly refreshing. Pick
up a 6-pack today, and tell your friends!
![]()
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug