Bottom Page

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.
Quote
#2
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 - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 130 Jan-05-2020, 11:50 AM
Last Post: vivekagrey
  How to get the index of a character from a string chihaya 1 130 Dec-03-2019, 12:54 PM
Last Post: buran
  python gives wrong string length and wrong character thienson30 2 223 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  How to Find & Count String Patterns Between two Markers in a HTML file ahmedwaqas92 3 304 Aug-19-2019, 10:12 AM
Last Post: ahmedwaqas92
  How can I find a string in sequence (with Booleans)? go127a 3 361 Apr-23-2019, 01:58 PM
Last Post: ichabod801
  remove string character from url jacklee26 10 1,165 Mar-25-2019, 03:56 PM
Last Post: Larz60+
  Replace changing string including uppercase character with lowercase character silfer 11 971 Mar-25-2019, 12:54 PM
Last Post: silfer
  Changing a character in a string Livne_ye 4 478 Mar-13-2019, 12:39 PM
Last Post: Larz60+
  String Method 'find(...)'. ClassicalSoul 3 422 Feb-27-2019, 12:24 PM
Last Post: buran
  Find ? in string MuntyScruntfundle 5 510 Jan-17-2019, 08:11 PM
Last Post: buran

Forum Jump:


Users browsing this thread: 1 Guest(s)