User Profile

Collapse

Profile Sidebar

Collapse
Michael Colon
Michael Colon
Last Activity: Dec 31 '10, 06:14 PM
Joined: Dec 31 '10
Location: Pennsylvania
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Michael Colon
    replied to [Python] Read .txt file and analayze
    Code:
    #-------------------------------------------------#
    # Set Variables                                   #
    #-------------------------------------------------#
    
    input = open("file.txt")
    whitelist = ('a','b','c','d','e','f','g') # whitelist of letters
    letters = {}
    
    #-------------------------------------------------#
    #  Functions                                      #
    #-------------------------------------------------#
    ...
    See more | Go to post

    Leave a comment:


  • Michael Colon
    replied to Iterating over a file in python
    Personally, I love python for many reasons, especially when it comes to parsing things and shifting things. This next piece of code should take you to the next level in python development.

    Code:
    input = open("inputfile.txt")
    output = open("outputfile.txt", 'w')
    
    output.writelines([(line) for line in input if not line.startswith('>')])
    And thats it!
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...