[Crossfire-wiki] [Crossfire DokuWiki] page changed: book.py

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Wed Apr 29 14:16:46 CDT 2009


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2009/04/29 14:16
User        : 
Edit Summary: removed

@@ -1,35 +1 @@
- ====== book.py ======
  
- <code python>
- #! /usr/bin/env python
- 
- import sys
- 
- # A simple client-side script to write a book from a text file. 
- # It requires that you have a pen, and marked a book 
- # or other writable object. 
- # Then, issue the command 'script PATH/TO/book.py file/to/write/to/book'.
- 
- DEFAULT_PATH="PATH_TO_TXT_FILE_HERE"
- 
- path = DEFAULT_PATH 
- if len(sys.argv) > 1: 
-   path = sys.argv[1]
- 
- try: 
-   file = open(path, "r") 
- 
- except: print "draw 7 Unable to open '%s':", # Don't end the line yet. 
-   if isinstance(str, sys.exc_info()[0]): 
-     print sys.exc_info()[0] 
-   else: print str(sys.exc_info()[1]) 
- else: 
-   lines = file.readlines()
- 
-   # This is kind of messy, since it puts out 2 newlines per actual
-   # line because, "print" adds a "newline" character; it works fine though
-   for line in lines: 
-     print("issue 1 1 use+skill inscription " + line) 
- finally: 
-   file.close()
- </code>


IP-Address  : 70.245.1.210
Old Revision: http://wiki.metalforge.net/doku.php/book.py?rev=1163693843
New Revision: http://wiki.metalforge.net/doku.php/book.py

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/




More information about the crossfire-wiki mailing list