User Profile

Collapse

Profile Sidebar

Collapse
twohot
twohot
Last Activity: Jan 4 '11, 04:09 PM
Joined: Dec 5 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • twohot
    replied to [Python] Read .txt file and analayze
    Very neat Michael
    See more | Go to post

    Leave a comment:


  • twohot
    replied to automatic python variables
    That's what I thought ... since I don't anticipate anything more than a few thousands of files-lines (for the properties and not instances .....well, looking at about 10 to 20 instances at most). I'd probably go the 'class' way. I don't really plan to hold much in memory anyway, so the class object overhead shouldn't be significant.
    See more | Go to post

    Leave a comment:


  • twohot
    replied to Iterating over a file in python
    @ bartonc



    Now I'm listening. What are those cool methods?...
    See more | Go to post

    Leave a comment:


  • twohot
    replied to [Python] Read .txt file and analayze
    Modifying Sean's Code:

    Code:
    #!/bin/python3
    
    def countLetters(line, letter):
       ret = 0
       for character in line:
          if character == letter: ret += 1
       return ret
    
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    #you can automate this using ascii codes too
    
    for line in open("file.txt",'r'):
       line = line.strip() #remove trailing spaces
       print (line)
    ...
    See more | Go to post
    Last edited by twohot; Dec 27 '10, 06:56 AM. Reason: forgot to wrap the code section in code tags

    Leave a comment:


  • twohot
    replied to automatic python variables
    And what if you plan to do more than list the books? Say, be able to access each book's properties eg. chapters, publisher, author, genre, revisions. Would a dictionary still do?

    Wouldn't it be better to have a list of object 'books' where the enumeration serves as a serial/key. eg book[1],book[2] ....book[n], each managing its own little db? or is SQL better off at this kind of thing?

    Just thinking ...:o, Like I said, its...
    See more | Go to post
    Last edited by twohot; Dec 27 '10, 05:53 AM. Reason: missed a few points

    Leave a comment:


  • twohot
    started a topic automatic python variables

    automatic python variables

    I'm looking for ways to create variables in python3 as needed. E.g

    book1 = book(name1) # book is a class
    book2 = book(name2)
    book3 = book(name3)
    book4 = book(name4)
    book5 = book(name5)
    :
    :
    :
    V
    book-n = book(name-n)

    I have the names of the book in a list but want to load those into class instances to take advantage off OOP. I could assign five to ten class objects like above...
    See more | Go to post

  • twohot
    replied to What is your OS and Python Version
    Python 3.1 and 2.7
    IDE = Geany, Komodo EDIT, Gedit
    See more | Go to post

    Leave a comment:


  • twohot
    started a topic Threading Or Multiprocessing???

    Threading Or Multiprocessing???

    This issue is probably discussed before. However, I can still use a little insight. I am a python beginner looking to develop a small client/server suite. The clients will reside in different PCs across a LAN and their job is to recieve a file (say, a .txt file) from the Server and open it with local copies of another application (say,Gnote ... I use Linux). The clients interact with their local Gnote and report states/progress to the Server....
    See more | Go to post
No activity results to display
Show More
Working...