[Python-3000-checkins] r56418 ...

skip at pobox.com skip at pobox.com
Sun Jul 22 13:38:34 CEST 2007


    Log:
    Run 2to3 over the Demo/ directory to shut up parse errors from 2to3
    about lingering print statements. 
    ...
    Modified: python/branches/py3k-struni/Demo/cgi/cgi2.py
    ==============================================================================
    --- python/branches/py3k-struni/Demo/cgi/cgi2.py    (original)
    +++ python/branches/py3k-struni/Demo/cgi/cgi2.py    Tue Jul 17 22:59:35 2007
    @@ -8,15 +8,15 @@

     def main():
         form = cgi.FieldStorage()
    -    print "Content-type: text/html"
    -    print
    +    print("Content-type: text/html")
    +    print()
         if not form:
    -        print "<h1>No Form Keys</h1>"
    +        print("<h1>No Form Keys</h1>")
         else:
    -        print "<h1>Form Keys</h1>"
    -        for key in form.keys():
    +        print("<h1>Form Keys</h1>")
    +        for key in list(form.keys()):
                 value = form[key].value
    -            print "<p>", cgi.escape(key), ":", cgi.escape(value)
    +            print("<p>", cgi.escape(key), ":", cgi.escape(value))

     if __name__ == "__main__":
         main()

Shouldn't the list(dictionary.keys()) construct only be applied where it's
needed?

Skip



More information about the Python-3000-checkins mailing list