Search:

Type: Posts; User: TwoEars; Keyword(s):

Page 1 of 9 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    9
    Views
    593

    Re: Need a software devolper and an artist

    Universe here. Don't ask about 42; it's confidential.


    Awesome! So all we have to do is make it!


    Well, that would be awful. What would the point be, other than just to copy it's interface,...
  2. Replies
    3
    Views
    6,771

    Re: Python: Compare list elements to string

    Well, there are lots of ways of doing this -




    def get_name():

    invalid = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')']

    Every time this function is called, this gets defined. I...
  3. Replies
    10
    Views
    671

    Re: python compiler

    Depends entirely on what you mean and what you understand. Clarify that, and you'll get your answer ;)
  4. Replies
    17
    Views
    613

    Re: Beginner: Python Syntax

    Well, that depends. If you want to write production code that relies on 3rd party software, stick with Python 2. Otherwise, Python 2 or Python 3 are both great, but there's more 3rd party resources...
  5. Replies
    17
    Views
    613

    Re: Beginner: Python Syntax

    Yes, you can do it, but don't. Hardly anybody in the Python world uses them, and those who do don't follow convention, and as a result should be shunned ;). Shun the non-believer, shun!


    As in ...
  6. Replies
    8
    Views
    969

    Re: haskell programming

    You need to know one of the "big" three there, Java, C/C++, or Python, but as long as you can think on your feet they don't mind too much. ;) You obviously need to know the core of CS though.
  7. Replies
    6
    Views
    433

    Re: Python Looping question

    # insert the first token (whatever comes before the ':')
    # into the end of the firstWords list
    firstWords.insert(len(firstWords),tokens[0])
    What's all this about? What do you think .append...
  8. Replies
    8
    Views
    969

    Re: haskell programming

    Google doesn't look for Haskell programmers, you can use it internally if you want, but they don't look for it. They don't look for a language at all, actually, most of the time it's based on your...
  9. Replies
    41
    Views
    2,762

    Re: Development with Quickly

    No need. You can use Python.

    Read here- http://www.riverbankcomputing.com/static/Docs/PyQt4/html/
  10. Re: Trying to remember the name of a command...

    Fortune?


    fortune | cowsay
  11. Replies
    9
    Views
    356

    Re: Python variable return on request

    Well, in Python, while True: is used a lot more, generally because it gives you better handling of what happens, and cuts down on lines.

    Have a look at this - http://wiki.python.org/moin/WhileLoop
  12. Replies
    9
    Views
    356

    Re: Python variable return on request

    1) Every time you need to map a set of keys to a set of values, you should use dict. See http://docs.python.org/tutorial/datastructures.html#dictionaries



    2) break.


    print 'Before while.'...
  13. Replies
    15
    Views
    607

    Re: Beginners Challenge 3

    With isn't really there for that sort of error catching (with file opening, though it is possible). Instead, with is there to ensure your file is closed no matter what happens inside the with...
  14. Replies
    15
    Views
    607

    Re: Beginners Challenge 3

    As far as I can see, this should work.


    Here, the formatting is in the wrong place -

    Try this instead -


    outfile.write('%d. %s' % (linenum, lang[0]))
  15. Replies
    15
    Views
    607

    Re: Beginners Challenge 3

    Well, lambda is handy when you need it - not so much when you don't. Learning to use it in the correct place is probably the most important bit of learning them ;)

    Well, you could've changed your...
  16. Replies
    8
    Views
    969

    Re: haskell programming

    Well, have you actually tried writing any of your own code? Having the concept is great, but you also need to know how to convert concepts to code. Try some challenges and see how you get along.

    ...
  17. Replies
    15
    Views
    607

    Re: Beginners Challenge 3

    True, but
    1) It makes for more reusable code, which code should always be
    2) It saves using tuple unpacking and IMO, that makes code a lot cleaner in code such as this. lang1 and lang2 aren't...
  18. Replies
    15
    Views
    607

    Re: Beginners Challenge 3

    Very good :D

    One little comment though - instead of



    (lang1, lang2) = pattern.search(line).groups()
    lang = lang1 + lang2
    You could use the reduce function, for example -
  19. Replies
    7
    Views
    2,331

    Re: i cant run my python programs

    With chmod +x, of course. :)
  20. Replies
    20
    Views
    812

    Re: [PYTHON] Replace a document line

    That could've been resolved if you changed your

    line = line.replace(cad, 'R'+cad)

    to being encapsulated in an if statement. ;)
  21. Replies
    20
    Views
    812

    Re: [PYTHON] Replace a document line

    def reserve_seat():
    cad = input("Which seat to reserve? ")
    reservation=open("reservation.pycine", "r+", encoding="utf-8")
    for line in reservation:
    reservation.close()
    ...
  22. Replies
    20
    Views
    812

    Re: [PYTHON] Replace a document line

    I would suggest first reading the contents, closing the file, reopen the file for writing (completely clearing the file wth 'w'), and then try your code.
  23. Replies
    20
    Views
    812

    Re: [PYTHON] Replace a document line

    Yup, unless you want to spend time looking into seek and other complicated features of file objects. ;)

    Now, for the other tip -

    Say I have the code like you have,



    random_numbers =...
  24. Replies
    20
    Views
    812

    Re: [PYTHON] Replace a document line

    Doh, in the time I wrote the reply, you had edited your text and had found the problem. Well done ;)

    My suggestion to you is to find out how you save any old file - though, it's more a case of...
  25. Replies
    20
    Views
    812

    Re: [PYTHON] Replace a document line

    Alright, let me give you a clue -

    Change the function to this -



    def reserve_seat():
    cad = input("Which seat to reserve? ")
    reservation=open("reservation.pycine", "r+",...
Results 1 to 25 of 219
Page 1 of 9 1 2 3 4