User Profile

Collapse

Profile Sidebar

Collapse
Dev Player
Dev Player
Last Activity: Oct 13 '11, 02:22 AM
Joined: Jan 20 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • IMHO, Python is a better choice for apps that run on different platforms. Type Python lanuage itself, it's basic data types, file io, and standard libraries themselves are very easy to learn and use.

    Doing simple gui windows with simple controls like buttons and checkboxes in Python's wxPython or Tinker is pretty quick. Doing anything more complicated and you'll not make your deadline.

    Quickly gander at: http://wik...
    See more | Go to post

    Leave a comment:


  • Try it like this:

    Code:
    #!/usr/local/bin/python
    
    # TEMPERATURE CONVERSIONS / temps.txt / 09/01/2011
    # CELSIUS / FAHRENHEIT / CONVERSIONS
    # Alan Stewart  /  1-(361)-980-1877
    #              
    
    import sys
    
    # If no arguments were given,print a helpful message.
    if len(sys.argv) <= 1:
        print('Usage: celsius temp1 temp2  ...')
        sys.exit(0)
    ...
    See more | Go to post
    Last edited by Niheel; Sep 14 '11, 04:20 PM. Reason: Easier to understand that code is reference if in same post

    Leave a comment:


  • If original order of your data matters the above solutions are the way to go. BUT, some assumptions are made in the answers to your question.

    You say "remove duplicate data". It's assumed that you mean to remove the -extra- duplicate items from your data, but to also retain only one copy of that item, as opposed to removing all items that are duplicated including the first occurance.

    It also assumes that the...
    See more | Go to post

    Leave a comment:


  • Cut and past the code below and save in a different file; although I see you code in my webbrowser I see that code in the fonts on my system; It's possible the fonts on your system are hiding your syntax error. Although I doubt that.

    Your code works fine on my pc. WinXP Pro-32bit SP3, Python 2.7

    Code:
    import itertools
    print('"""')
    variations = itertools.product('ab', repeat=4)
    for variation
    ...
    See more | Go to post

    Leave a comment:


  • Dev Player
    replied to manipulating string question
    Another wide-spread used string manipulation tool, although not really suited to your issue here is the re module, which refers to regex.

    Some feel regex is clunky and learning regex is not so simple for some. But regex is used in many other programming areas outside of Python.

    import re
    dir(re)
    help(re)
    help(re.findall
    )

    So not for this post, but it'll help round out one's skills with...
    See more | Go to post

    Leave a comment:


  • Dev Player
    replied to manipulating string question
    I really like bvdet's solution, succinct and Pythonic. Make it in a function and you are good to go.

    It's a little cryptic for some beginners as list comprehensions are not often a well practiced looping tool. All those string escapes can camoflage its elegance.

    And the join() function is backwards looking to beginners too as it looks like this:
    seperator.join( sequence) instead of
    join(sequence, se...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...