About to start a new project & looking for advice

Page 3 of 3 FirstFirst 123

  1. Posts : 110
    Windows 7 Professional x64
       #21

    McP2143 said:
    I made a couple adjustments to briceh's program.

    Drag & Drop

    Still working on it but this works perfectly fine.

    Attachment 158456
    Very nice. One thing you might want to do is have it delete the quotation marks at the beginning and end of the file path when the use drags in a file. By the way, to take the middle characters of a string, you can use the following code:
    Code:
    string = "aThis is a string.a"
    newString = string[1:-1] # newString will be "This is a string."
    Hope this helps. I can make this addition for you if you want, but it sounds as if you might be enjoying making your own edits.
      My Computer


  2. Posts : 28
    Windows 7 Home Premium 64bit.
    Thread Starter
       #22

    Guilty as charged:)

    My biggest problem with removing the charcters is that they are different lengths for differnt files. I need to be able to take out everything up to and including the blank line after the words "PICK LIST" in order for this to run properly. This catch phrase occurs on a different line in each file. Have you tried out the full examples from my earlier post?

    Also I needed to change the open line as it wouldn't accept the path c:\

    I am trying to add a counter of sort to the "counted.txt" would like to get multiple files from one run "counted1.txt, counted2.txt, ..." and possible put them in their own folder?

    Oh well to bed for me. Gotta wake up in 4 hrs... and counting
      My Computer


  3. Posts : 28
    Windows 7 Home Premium 64bit.
    Thread Starter
       #23

    So i added the numbers to the save files. All Good!
    Now to make this cut the nonsense from the original file.
    Here is what I came up with so far.
    Code:
    import os.path
    import time
    
    def showme (afile):
        INfile = open(afile,'rt')
        text = INfile.read()
        print(afile)
        print(text)
    
    
    def FindPicklist(bfile):
        INf = open(bfile)
        for line in INf:
                print (line)
                time.sleep(0)
                if ("  PICK LIST") in (line):
                    print ("*"*800)
    
        
    while True: 
        UFile = input ("Pick A File To View: ")
        if os.path.isfile(UFile):
            #showme(UFile)
            FindPicklist(UFile)
        else:
            print ("That isn't a file.")
      My Computer


 
Page 3 of 3 FirstFirst 123

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:57.
Find Us