Hi, I'm Al, the author of Invent Your Own Computer Games with Python.
The book does indeed cover Pygame. The last four chapters covers the
Pygame library, and the final one has the source code for a complete
game.
I still recommend learning Python first though, it will make it much
easier to under
Ken,
You should probably use the sorting functionality that your DBMS
provides. However, if you have a list of strings that end with a new
line and start with an apostrophe, you can use list comprehensions to
remove them:
newlist = [x[1:-1] for x in newlist]
You can look at the following links t
Tim,
I've checked your code and it seems to work as far as using newlines
for the line terminator. The default line terminator is \r\n, which
might not show up correctly in some text editors.
Otherwise, try checking to see if you've specified a blank line for
the line terminator. You can set it e
max() for strings returns the largest string in an alphabetical sense.
So max(['z', 'aa']) would return 'z'.
You need to specify an ordering function, in your case, len():
max( ['z', ''], key=len)
...which will return '' because it is ordering by key.
-Al Sweigart
I'd recommend Doug Hellman's Python Module of the Week blog (PyMOTW)
at http://www.doughellmann.com/projects/PyMOTW/
He goes into each of the standard library modules and gives examples
of them in use.
Dive Into Python 3 by Mark Pilgrim is also good for getting up to
speed on Python 3. http://div
Your problem is on this line:
fobj.write('\n'.join(all))
This puts a newline in between each line in "all", but not at the end.
The fix is simple:
fobj.write('\n'.join(all) + '\n')
This will make sure that the last line has a newline at the end of it,
so that when you later append data, it will
I'd recommend my book, "Invent Your Own Computer Games with Python",
which is available for free at:
http://inventwithpython.com
Each chapter focuses on the complete source code for a small game, and
teaches programming concepts from the code.
-Al
> Hi
> I'm trying to learn python but I have di