Python Forum
Find string and add character - newbi
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find string and add character - newbi
#1
I am in the process of learning Python. Now I have a concrete challenge I would like to give my self. Once in a while I need to do some changes in a VB-script txt file. I would like to automate those tasks – and here I need your help. Can you help me figure out how to complete the tasks or send me hints or links for what functions to look for. Thank you a lot in advance for taking time ?

This is what I think should be automated:

1. Open the txt file
2. Find these to sentences and insert a “’” in front of the text (to outcomment in VB)
If bStatus Then bStatus=File_ExistFile(gsCommonDesktop & "\Google Chrome.lnk",False)
If bStatus and gbValue=True Then bStatus = File_DelFile(gsCommonDesktop & "\Google Chrome.lnk",TRUE)
3. Find this sentence and change the very last number (1) to the number zero (0)
4. Save the file.
Reply


Messages In This Thread
Find string and add character - newbi - by PyDK - May-15-2019, 09:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  use of escape character in re.sub and find WJSwan 1 916 Feb-16-2023, 05:19 PM
Last Post: Larz60+
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,386 Sep-27-2022, 01:38 PM
Last Post: buran
  Find and Replace numbers in String giddyhead 2 1,244 Jul-17-2022, 06:22 PM
Last Post: giddyhead
  Regex: a string does not starts and ends with the same character Melcu54 5 2,434 Jul-04-2021, 07:51 PM
Last Post: Melcu54
  [solved] unexpected character after line continuation character paul18fr 4 3,419 Jun-22-2021, 03:22 PM
Last Post: deanhystad
  Find string between two substrings, in a stream of data xbit 1 2,162 May-09-2021, 03:32 PM
Last Post: bowlofred
  Regular expression: cannot find 1st number in a string Pavel_47 2 2,427 Jan-15-2021, 04:39 PM
Last Post: bowlofred
  find a string in a field in MongoDB Leon79 2 2,444 Jul-19-2020, 09:20 PM
Last Post: menator01
  SyntaxError: unexpected character after line continuation character siteshkumar 2 3,189 Jul-13-2020, 07:05 PM
Last Post: snippsat
  Remove from end of string up to and including some character lbtdne 2 2,353 May-17-2020, 09:24 AM
Last Post: menator01

Forum Jump:

User Panel Messages

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