Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Find string and add character - newbi
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.
What have you tried? We're not big on writing code for people here, but we would be happy to help you fix your code when you run into problems. When you do run into problems, please post your code in Python tags, and clearly explain the problem you are having, including the full text of any errors.
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Remove from end of string up to and including some character lbtdne 2 282 May-17-2020, 09:24 AM
Last Post: menator01
  Help to find a string and read the next lines crlamaral 4 384 Mar-19-2020, 09:24 AM
Last Post: Larz60+
  How To Find an Opening and Closing String, Copying Open/Close/Contents to New File davidshq 1 281 Mar-03-2020, 04:47 AM
Last Post: davidshq
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 337 Jan-05-2020, 11:50 AM
Last Post: vivekagrey
  How to get the index of a character from a string chihaya 1 298 Dec-03-2019, 12:54 PM
Last Post: buran
  python gives wrong string length and wrong character thienson30 2 429 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  How to Find & Count String Patterns Between two Markers in a HTML file ahmedwaqas92 3 508 Aug-19-2019, 10:12 AM
Last Post: ahmedwaqas92
  How can I find a string in sequence (with Booleans)? go127a 3 526 Apr-23-2019, 01:58 PM
Last Post: ichabod801
  remove string character from url jacklee26 10 1,589 Mar-25-2019, 03:56 PM
Last Post: Larz60+
  Replace changing string including uppercase character with lowercase character silfer 11 1,362 Mar-25-2019, 12:54 PM
Last Post: silfer

Forum Jump:

Users browsing this thread: 1 Guest(s)