Python-Ref > Dynamic web pages in Python > Generating non-HTML output
 
 

<-^^
Klíčová slova
Moduly
Knihovní funkce

Generating non-HTML output

How to change the mime-type of the resulting document.
The mime-type of a document that is sent by the HTTP server as part of the HTTP header (the Content-Type field) determines how the data will be handled by the client. mod_pythons publisher handler send the output of your script as "text/html". This is ok in most cases, but when you generate an XML or PDF online, it can break things down seriously.
The following example shows the result with the default mime-type.
Expand/Shrink
Zdroj: (dpages7-1.py)
  1   import MySQLdb
  2   from MySQLdb.cursors import DictCursor
  3   
  4   def index( search_text=""):
  5     body = "<countries>"
  6     connection = MySQLdb.connect( user="test", passwd="pass123", db="world", host="localhost", cursorclass=DictCursor)
  7     cursor1 = connection.cursor()
  8   
  9     cursor1.execute( "SELECT Name,Population FROM Country WHERE Name LIKE '%%%s%%' ORDER BY Name;" % search_text)
 10     for i in range( cursor1.rowcount):
 11       data = cursor1.fetchone()
 12       body += "<country><name>%s</name><population>%d</population></country>" % (data["Name"], data["Population"])
 13     body += "</countries>"
 14   
 15     cursor1.close()
 16     connection.close()
 17   
 18     return body
<countries><country><name>Afghanistan</name><population>22720000</population></country><country><name>Albania</name><population>3401200</population></country><country><name>Algeria</name><population>31471000</population></country><country><name>American Samoa</name><population>68000</population></country><country><name>Andorra</name><population>78000</population></country><country><name>Angola</name><population>12878000</population></country><country><name>Anguilla</name><population>8000</population></country><country><name>Antarctica</name><population>0</population></country><country><name>Antigua and Barbuda</name><population>68000</population></country><country><name>Argentina</name><population>37032000</population></country><country><name>Armenia</name><population>3520000</population></country><country><name>Aruba</name><population>103000</population></country><country><name>Australia</name><population>18886000</population></country><country><name>Austria</name><population>8091800</population></country><country><name>Azerbaijan</name><population>7734000</population></country><country><name>Bahamas</name><population>307000</population></country><country><name>Bahrain</name><population>617000</population></country><country><name>Bangladesh</name><population>129155000</population></country><country><name>Barbados</name><population>270000</population></country><country><name>Belarus</name><population>10236000</population></country><country><name>Belgium</name><population>10239000</population></country><country><name>Belize</name><population>241000</population></country><country><name>Benin</name><population>6097000</population></country><country><name>Bermuda</name><population>65000</population></country><country><name>Bhutan</name><population>2124000</population></country><country><name>Bolivia</name><population>8329000</population></country><country><name>Bosnia and Herzegovina</name><population>3972000</population></country><country><name>Botswana</name><population>1622000</population></country><country><name>Bouvet Island</name><population>0</population></country><country><name>Brazil</name><population>170115000</population></country><country><name>British Indian Ocean Territory</name><population>0</population></country><country><name>Brunei</name><population>328000</population></country><country><name>Bulgaria</name><population>8190900</population></country><country><name>Burkina Faso</name><population>11937000</population></country><country><name>Burundi</name><population>6695000</population></country><country><name>Cambodia</name><population>11168000</population></country><country><name>Cameroon</name><population>15085000</population></country><country><name>Canada</name><population>31147000</population></country><country><name>Cape Verde</name><population>428000</population></country><country><name>Cayman Islands</name><population>38000</population></country><country><name>Central African Republic</name><population>3615000</population></country><country><name>Chad</name><population>7651000</population></country><country><name>Chile</name><population>15211000</population></country><country><name>China</name><population>1277558000</population></country><country><name>Christmas Island</name><population>2500</population></country><country><name>Cocos (Keeling) Islands</name><population>600</population></country><country><name>Colombia</name><population>42321000</population></country><country><name>Comoros</name><population>578000</population></country><country><name>Congo</name><population>2943000</population></country><country><name>Congo, The Democratic Republic of the</name><population>51654000</population></country><country><name>Cook Islands</name><population>20000</population></country><country><name>Costa Rica</name><population>4023000</population></country><country><name>Côte d’Ivoire</name><population>14786000</population></country><country><name>Croatia</name><population>4473000</population></country><country><name>Cuba</name><population>11201000</population></country><country><name>Cyprus</name><population>754700</population></country><country><name>Czech Republic</name><population>10278100</population></country><country><name>Denmark</name><population>5330000</population></country><country><name>Djibouti</name><population>638000</population></country><country><name>Dominica</name><population>71000</population></country><country><name>Dominican Republic</name><population>8495000</population></country><country><name>East Timor</name><population>885000</population></country><country><name>Ecuador</name><population>12646000</population></country><country><name>Egypt</name><population>68470000</population></country><country><name>El Salvador</name><population>6276000</population></country><country><name>Equatorial Guinea</name><population>453000</population></country><country><name>Eritrea</name><population>3850000</population></country><country><name>Estonia</name><population>1439200</population></country><country><name>Ethiopia</name><population>62565000</population></country><country><name>Falkland Islands</name><population>2000</population></country><country><name>Faroe Islands</name><population>43000</population></country><country><name>Fiji Islands</name><population>817000</population></country><country><name>Finland</name><population>5171300</population></country><country><name>France</name><population>59225700</population></country><country><name>French Guiana</name><population>181000</population></country><country><name>French Polynesia</name><population>235000</population></country><country><name>French Southern territories</name><population>0</population></country><country><name>Gabon</name><population>1226000</population></country><country><name>Gambia</name><population>1305000</population></country><country><name>Georgia</name><population>4968000</population></country><country><name>Germany</name><population>82164700</population></country><country><name>Ghana</name><population>20212000</population></country><country><name>Gibraltar</name><population>25000</population></country><country><name>Greece</name><population>10545700</population></country><country><name>Greenland</name><population>56000</population></country><country><name>Grenada</name><population>94000</population></country><country><name>Guadeloupe</name><population>456000</population></country><country><name>Guam</name><population>168000</population></country><country><name>Guatemala</name><population>11385000</population></country><country><name>Guinea</name><population>7430000</population></country><country><name>Guinea-Bissau</name><population>1213000</population></country><country><name>Guyana</name><population>861000</population></country><country><name>Haiti</name><population>8222000</population></country><country><name>Heard Island and McDonald Islands</name><population>0</population></country><country><name>Holy See (Vatican City State)</name><population>1000</population></country><country><name>Honduras</name><population>6485000</population></country><country><name>Hong Kong</name><population>6782000</population></country><country><name>Hungary</name><population>10043200</population></country><country><name>Iceland</name><population>279000</population></country><country><name>India</name><population>1013662000</population></country><country><name>Indonesia</name><population>212107000</population></country><country><name>Iran</name><population>67702000</population></country><country><name>Iraq</name><population>23115000</population></country><country><name>Ireland</name><population>3775100</population></country><country><name>Israel</name><population>6217000</population></country><country><name>Italy</name><population>57680000</population></country><country><name>Jamaica</name><population>2583000</population></country><country><name>Japan</name><population>126714000</population></country><country><name>Jordan</name><population>5083000</population></country><country><name>Kazakstan</name><population>16223000</population></country><country><name>Kenya</name><population>30080000</population></country><country><name>Kiribati</name><population>83000</population></country><country><name>Kuwait</name><population>1972000</population></country><country><name>Kyrgyzstan</name><population>4699000</population></country><country><name>Laos</name><population>5433000</population></country><country><name>Latvia</name><population>2424200</population></country><country><name>Lebanon</name><population>3282000</population></country><country><name>Lesotho</name><population>2153000</population></country><country><name>Liberia</name><population>3154000</population></country><country><name>Libyan Arab Jamahiriya</name><population>5605000</population></country><country><name>Liechtenstein</name><population>32300</population></country><country><name>Lithuania</name><population>3698500</population></country><country><name>Luxembourg</name><population>435700</population></country><country><name>Macao</name><population>473000</population></country><country><name>Macedonia</name><population>2024000</population></country><country><name>Madagascar</name><population>15942000</population></country><country><name>Malawi</name><population>10925000</population></country><country><name>Malaysia</name><population>22244000</population></country><country><name>Maldives</name><population>286000</population></country><country><name>Mali</name><population>11234000</population></country><country><name>Malta</name><population>380200</population></country><country><name>Marshall Islands</name><population>64000</population></country><country><name>Martinique</name><population>395000</population></country><country><name>Mauritania</name><population>2670000</population></country><country><name>Mauritius</name><population>1158000</population></country><country><name>Mayotte</name><population>149000</population></country><country><name>Mexico</name><population>98881000</population></country><country><name>Micronesia, Federated States of</name><population>119000</population></country><country><name>Moldova</name><population>4380000</population></country><country><name>Monaco</name><population>34000</population></country><country><name>Mongolia</name><population>2662000</population></country><country><name>Montserrat</name><population>11000</population></country><country><name>Morocco</name><population>28351000</population></country><country><name>Mozambique</name><population>19680000</population></country><country><name>Myanmar</name><population>45611000</population></country><country><name>Namibia</name><population>1726000</population></country><country><name>Nauru</name><population>12000</population></country><country><name>Nepal</name><population>23930000</population></country><country><name>Netherlands</name><population>15864000</population></country><country><name>Netherlands Antilles</name><population>217000</population></country><country><name>New Caledonia</name><population>214000</population></country><country><name>New Zealand</name><population>3862000</population></country><country><name>Nicaragua</name><population>5074000</population></country><country><name>Niger</name><population>10730000</population></country><country><name>Nigeria</name><population>111506000</population></country><country><name>Niue</name><population>2000</population></country><country><name>Norfolk Island</name><population>2000</population></country><country><name>North Korea</name><population>24039000</population></country><country><name>Northern Mariana Islands</name><population>78000</population></country><country><name>Norway</name><population>4478500</population></country><country><name>Oman</name><population>2542000</population></country><country><name>Pakistan</name><population>156483000</population></country><country><name>Palau</name><population>19000</population></country><country><name>Palestine</name><population>3101000</population></country><country><name>Panama</name><population>2856000</population></country><country><name>Papua New Guinea</name><population>4807000</population></country><country><name>Paraguay</name><population>5496000</population></country><country><name>Peru</name><population>25662000</population></country><country><name>Philippines</name><population>75967000</population></country><country><name>Pitcairn</name><population>50</population></country><country><name>Poland</name><population>38653600</population></country><country><name>Portugal</name><population>9997600</population></country><country><name>Puerto Rico</name><population>3869000</population></country><country><name>Qatar</name><population>599000</population></country><country><name>Réunion</name><population>699000</population></country><country><name>Romania</name><population>22455500</population></country><country><name>Russian Federation</name><population>146934000</population></country><country><name>Rwanda</name><population>7733000</population></country><country><name>Saint Helena</name><population>6000</population></country><country><name>Saint Kitts and Nevis</name><population>38000</population></country><country><name>Saint Lucia</name><population>154000</population></country><country><name>Saint Pierre and Miquelon</name><population>7000</population></country><country><name>Saint Vincent and the Grenadines</name><population>114000</population></country><country><name>Samoa</name><population>180000</population></country><country><name>San Marino</name><population>27000</population></country><country><name>Sao Tome and Principe</name><population>147000</population></country><country><name>Saudi Arabia</name><population>21607000</population></country><country><name>Senegal</name><population>9481000</population></country><country><name>Seychelles</name><population>77000</population></country><country><name>Sierra Leone</name><population>4854000</population></country><country><name>Singapore</name><population>3567000</population></country><country><name>Slovakia</name><population>5398700</population></country><country><name>Slovenia</name><population>1987800</population></country><country><name>Solomon Islands</name><population>444000</population></country><country><name>Somalia</name><population>10097000</population></country><country><name>South Africa</name><population>40377000</population></country><country><name>South Georgia and the South Sandwich Islands</name><population>0</population></country><country><name>South Korea</name><population>46844000</population></country><country><name>Spain</name><population>39441700</population></country><country><name>Sri Lanka</name><population>18827000</population></country><country><name>Sudan</name><population>29490000</population></country><country><name>Suriname</name><population>417000</population></country><country><name>Svalbard and Jan Mayen</name><population>3200</population></country><country><name>Swaziland</name><population>1008000</population></country><country><name>Sweden</name><population>8861400</population></country><country><name>Switzerland</name><population>7160400</population></country><country><name>Syria</name><population>16125000</population></country><country><name>Taiwan</name><population>22256000</population></country><country><name>Tajikistan</name><population>6188000</population></country><country><name>Tanzania</name><population>33517000</population></country><country><name>Thailand</name><population>61399000</population></country><country><name>Togo</name><population>4629000</population></country><country><name>Tokelau</name><population>2000</population></country><country><name>Tonga</name><population>99000</population></country><country><name>Trinidad and Tobago</name><population>1295000</population></country><country><name>Tunisia</name><population>9586000</population></country><country><name>Turkey</name><population>66591000</population></country><country><name>Turkmenistan</name><population>4459000</population></country><country><name>Turks and Caicos Islands</name><population>17000</population></country><country><name>Tuvalu</name><population>12000</population></country><country><name>Uganda</name><population>21778000</population></country><country><name>Ukraine</name><population>50456000</population></country><country><name>United Arab Emirates</name><population>2441000</population></country><country><name>United Kingdom</name><population>59623400</population></country><country><name>United States</name><population>278357000</population></country><country><name>United States Minor Outlying Islands</name><population>0</population></country><country><name>Uruguay</name><population>3337000</population></country><country><name>Uzbekistan</name><population>24318000</population></country><country><name>Vanuatu</name><population>190000</population></country><country><name>Venezuela</name><population>24170000</population></country><country><name>Vietnam</name><population>79832000</population></country><country><name>Virgin Islands, British</name><population>21000</population></country><country><name>Virgin Islands, U.S.</name><population>93000</population></country><country><name>Wallis and Futuna</name><population>15000</population></country><country><name>Western Sahara</name><population>293000</population></country><country><name>Yemen</name><population>18112000</population></country><country><name>Yugoslavia</name><population>10640000</population></country><country><name>Zambia</name><population>9169000</population></country><country><name>Zimbabwe</name><population>11669000</population></country></countries>
Doba běhu: 336.8 ms
The following example shows the result with the right mime-type. This is the first example in which we need the Request (req) object optionally passed to our function.
Expand/Shrink
Zdroj: (dpages7-2.py)
  1   import MySQLdb
  2   from MySQLdb.cursors import DictCursor
  3   
  4   def index( req, search_text=""):
  5     req.content_type = "text/xml"
  6     body = "<countries>"
  7     connection = MySQLdb.connect( user="test", passwd="pass123", db="world", host="localhost", cursorclass=DictCursor)
  8     cursor1 = connection.cursor()
  9   
 10     cursor1.execute( "SELECT Name,Population FROM Country WHERE Name LIKE '%%%s%%' ORDER BY Name;" % search_text)
 11     for i in range( cursor1.rowcount):
 12       data = cursor1.fetchone()
 13       body += "<country><name>%s</name><population>%d</population></country>" % (data["Name"], data["Population"])
 14     body += "</countries>"
 15   
 16     cursor1.close()
 17     connection.close()
 18   
 19     return body
<countries><country><name>Afghanistan</name><population>22720000</population></country><country><name>Albania</name><population>3401200</population></country><country><name>Algeria</name><population>31471000</population></country><country><name>American Samoa</name><population>68000</population></country><country><name>Andorra</name><population>78000</population></country><country><name>Angola</name><population>12878000</population></country><country><name>Anguilla</name><population>8000</population></country><country><name>Antarctica</name><population>0</population></country><country><name>Antigua and Barbuda</name><population>68000</population></country><country><name>Argentina</name><population>37032000</population></country><country><name>Armenia</name><population>3520000</population></country><country><name>Aruba</name><population>103000</population></country><country><name>Australia</name><population>18886000</population></country><country><name>Austria</name><population>8091800</population></country><country><name>Azerbaijan</name><population>7734000</population></country><country><name>Bahamas</name><population>307000</population></country><country><name>Bahrain</name><population>617000</population></country><country><name>Bangladesh</name><population>129155000</population></country><country><name>Barbados</name><population>270000</population></country><country><name>Belarus</name><population>10236000</population></country><country><name>Belgium</name><population>10239000</population></country><country><name>Belize</name><population>241000</population></country><country><name>Benin</name><population>6097000</population></country><country><name>Bermuda</name><population>65000</population></country><country><name>Bhutan</name><population>2124000</population></country><country><name>Bolivia</name><population>8329000</population></country><country><name>Bosnia and Herzegovina</name><population>3972000</population></country><country><name>Botswana</name><population>1622000</population></country><country><name>Bouvet Island</name><population>0</population></country><country><name>Brazil</name><population>170115000</population></country><country><name>British Indian Ocean Territory</name><population>0</population></country><country><name>Brunei</name><population>328000</population></country><country><name>Bulgaria</name><population>8190900</population></country><country><name>Burkina Faso</name><population>11937000</population></country><country><name>Burundi</name><population>6695000</population></country><country><name>Cambodia</name><population>11168000</population></country><country><name>Cameroon</name><population>15085000</population></country><country><name>Canada</name><population>31147000</population></country><country><name>Cape Verde</name><population>428000</population></country><country><name>Cayman Islands</name><population>38000</population></country><country><name>Central African Republic</name><population>3615000</population></country><country><name>Chad</name><population>7651000</population></country><country><name>Chile</name><population>15211000</population></country><country><name>China</name><population>1277558000</population></country><country><name>Christmas Island</name><population>2500</population></country><country><name>Cocos (Keeling) Islands</name><population>600</population></country><country><name>Colombia</name><population>42321000</population></country><country><name>Comoros</name><population>578000</population></country><country><name>Congo</name><population>2943000</population></country><country><name>Congo, The Democratic Republic of the</name><population>51654000</population></country><country><name>Cook Islands</name><population>20000</population></country><country><name>Costa Rica</name><population>4023000</population></country><country><name>Côte d’Ivoire</name><population>14786000</population></country><country><name>Croatia</name><population>4473000</population></country><country><name>Cuba</name><population>11201000</population></country><country><name>Cyprus</name><population>754700</population></country><country><name>Czech Republic</name><population>10278100</population></country><country><name>Denmark</name><population>5330000</population></country><country><name>Djibouti</name><population>638000</population></country><country><name>Dominica</name><population>71000</population></country><country><name>Dominican Republic</name><population>8495000</population></country><country><name>East Timor</name><population>885000</population></country><country><name>Ecuador</name><population>12646000</population></country><country><name>Egypt</name><population>68470000</population></country><country><name>El Salvador</name><population>6276000</population></country><country><name>Equatorial Guinea</name><population>453000</population></country><country><name>Eritrea</name><population>3850000</population></country><country><name>Estonia</name><population>1439200</population></country><country><name>Ethiopia</name><population>62565000</population></country><country><name>Falkland Islands</name><population>2000</population></country><country><name>Faroe Islands</name><population>43000</population></country><country><name>Fiji Islands</name><population>817000</population></country><country><name>Finland</name><population>5171300</population></country><country><name>France</name><population>59225700</population></country><country><name>French Guiana</name><population>181000</population></country><country><name>French Polynesia</name><population>235000</population></country><country><name>French Southern territories</name><population>0</population></country><country><name>Gabon</name><population>1226000</population></country><country><name>Gambia</name><population>1305000</population></country><country><name>Georgia</name><population>4968000</population></country><country><name>Germany</name><population>82164700</population></country><country><name>Ghana</name><population>20212000</population></country><country><name>Gibraltar</name><population>25000</population></country><country><name>Greece</name><population>10545700</population></country><country><name>Greenland</name><population>56000</population></country><country><name>Grenada</name><population>94000</population></country><country><name>Guadeloupe</name><population>456000</population></country><country><name>Guam</name><population>168000</population></country><country><name>Guatemala</name><population>11385000</population></country><country><name>Guinea</name><population>7430000</population></country><country><name>Guinea-Bissau</name><population>1213000</population></country><country><name>Guyana</name><population>861000</population></country><country><name>Haiti</name><population>8222000</population></country><country><name>Heard Island and McDonald Islands</name><population>0</population></country><country><name>Holy See (Vatican City State)</name><population>1000</population></country><country><name>Honduras</name><population>6485000</population></country><country><name>Hong Kong</name><population>6782000</population></country><country><name>Hungary</name><population>10043200</population></country><country><name>Iceland</name><population>279000</population></country><country><name>India</name><population>1013662000</population></country><country><name>Indonesia</name><population>212107000</population></country><country><name>Iran</name><population>67702000</population></country><country><name>Iraq</name><population>23115000</population></country><country><name>Ireland</name><population>3775100</population></country><country><name>Israel</name><population>6217000</population></country><country><name>Italy</name><population>57680000</population></country><country><name>Jamaica</name><population>2583000</population></country><country><name>Japan</name><population>126714000</population></country><country><name>Jordan</name><population>5083000</population></country><country><name>Kazakstan</name><population>16223000</population></country><country><name>Kenya</name><population>30080000</population></country><country><name>Kiribati</name><population>83000</population></country><country><name>Kuwait</name><population>1972000</population></country><country><name>Kyrgyzstan</name><population>4699000</population></country><country><name>Laos</name><population>5433000</population></country><country><name>Latvia</name><population>2424200</population></country><country><name>Lebanon</name><population>3282000</population></country><country><name>Lesotho</name><population>2153000</population></country><country><name>Liberia</name><population>3154000</population></country><country><name>Libyan Arab Jamahiriya</name><population>5605000</population></country><country><name>Liechtenstein</name><population>32300</population></country><country><name>Lithuania</name><population>3698500</population></country><country><name>Luxembourg</name><population>435700</population></country><country><name>Macao</name><population>473000</population></country><country><name>Macedonia</name><population>2024000</population></country><country><name>Madagascar</name><population>15942000</population></country><country><name>Malawi</name><population>10925000</population></country><country><name>Malaysia</name><population>22244000</population></country><country><name>Maldives</name><population>286000</population></country><country><name>Mali</name><population>11234000</population></country><country><name>Malta</name><population>380200</population></country><country><name>Marshall Islands</name><population>64000</population></country><country><name>Martinique</name><population>395000</population></country><country><name>Mauritania</name><population>2670000</population></country><country><name>Mauritius</name><population>1158000</population></country><country><name>Mayotte</name><population>149000</population></country><country><name>Mexico</name><population>98881000</population></country><country><name>Micronesia, Federated States of</name><population>119000</population></country><country><name>Moldova</name><population>4380000</population></country><country><name>Monaco</name><population>34000</population></country><country><name>Mongolia</name><population>2662000</population></country><country><name>Montserrat</name><population>11000</population></country><country><name>Morocco</name><population>28351000</population></country><country><name>Mozambique</name><population>19680000</population></country><country><name>Myanmar</name><population>45611000</population></country><country><name>Namibia</name><population>1726000</population></country><country><name>Nauru</name><population>12000</population></country><country><name>Nepal</name><population>23930000</population></country><country><name>Netherlands</name><population>15864000</population></country><country><name>Netherlands Antilles</name><population>217000</population></country><country><name>New Caledonia</name><population>214000</population></country><country><name>New Zealand</name><population>3862000</population></country><country><name>Nicaragua</name><population>5074000</population></country><country><name>Niger</name><population>10730000</population></country><country><name>Nigeria</name><population>111506000</population></country><country><name>Niue</name><population>2000</population></country><country><name>Norfolk Island</name><population>2000</population></country><country><name>North Korea</name><population>24039000</population></country><country><name>Northern Mariana Islands</name><population>78000</population></country><country><name>Norway</name><population>4478500</population></country><country><name>Oman</name><population>2542000</population></country><country><name>Pakistan</name><population>156483000</population></country><country><name>Palau</name><population>19000</population></country><country><name>Palestine</name><population>3101000</population></country><country><name>Panama</name><population>2856000</population></country><country><name>Papua New Guinea</name><population>4807000</population></country><country><name>Paraguay</name><population>5496000</population></country><country><name>Peru</name><population>25662000</population></country><country><name>Philippines</name><population>75967000</population></country><country><name>Pitcairn</name><population>50</population></country><country><name>Poland</name><population>38653600</population></country><country><name>Portugal</name><population>9997600</population></country><country><name>Puerto Rico</name><population>3869000</population></country><country><name>Qatar</name><population>599000</population></country><country><name>Réunion</name><population>699000</population></country><country><name>Romania</name><population>22455500</population></country><country><name>Russian Federation</name><population>146934000</population></country><country><name>Rwanda</name><population>7733000</population></country><country><name>Saint Helena</name><population>6000</population></country><country><name>Saint Kitts and Nevis</name><population>38000</population></country><country><name>Saint Lucia</name><population>154000</population></country><country><name>Saint Pierre and Miquelon</name><population>7000</population></country><country><name>Saint Vincent and the Grenadines</name><population>114000</population></country><country><name>Samoa</name><population>180000</population></country><country><name>San Marino</name><population>27000</population></country><country><name>Sao Tome and Principe</name><population>147000</population></country><country><name>Saudi Arabia</name><population>21607000</population></country><country><name>Senegal</name><population>9481000</population></country><country><name>Seychelles</name><population>77000</population></country><country><name>Sierra Leone</name><population>4854000</population></country><country><name>Singapore</name><population>3567000</population></country><country><name>Slovakia</name><population>5398700</population></country><country><name>Slovenia</name><population>1987800</population></country><country><name>Solomon Islands</name><population>444000</population></country><country><name>Somalia</name><population>10097000</population></country><country><name>South Africa</name><population>40377000</population></country><country><name>South Georgia and the South Sandwich Islands</name><population>0</population></country><country><name>South Korea</name><population>46844000</population></country><country><name>Spain</name><population>39441700</population></country><country><name>Sri Lanka</name><population>18827000</population></country><country><name>Sudan</name><population>29490000</population></country><country><name>Suriname</name><population>417000</population></country><country><name>Svalbard and Jan Mayen</name><population>3200</population></country><country><name>Swaziland</name><population>1008000</population></country><country><name>Sweden</name><population>8861400</population></country><country><name>Switzerland</name><population>7160400</population></country><country><name>Syria</name><population>16125000</population></country><country><name>Taiwan</name><population>22256000</population></country><country><name>Tajikistan</name><population>6188000</population></country><country><name>Tanzania</name><population>33517000</population></country><country><name>Thailand</name><population>61399000</population></country><country><name>Togo</name><population>4629000</population></country><country><name>Tokelau</name><population>2000</population></country><country><name>Tonga</name><population>99000</population></country><country><name>Trinidad and Tobago</name><population>1295000</population></country><country><name>Tunisia</name><population>9586000</population></country><country><name>Turkey</name><population>66591000</population></country><country><name>Turkmenistan</name><population>4459000</population></country><country><name>Turks and Caicos Islands</name><population>17000</population></country><country><name>Tuvalu</name><population>12000</population></country><country><name>Uganda</name><population>21778000</population></country><country><name>Ukraine</name><population>50456000</population></country><country><name>United Arab Emirates</name><population>2441000</population></country><country><name>United Kingdom</name><population>59623400</population></country><country><name>United States</name><population>278357000</population></country><country><name>United States Minor Outlying Islands</name><population>0</population></country><country><name>Uruguay</name><population>3337000</population></country><country><name>Uzbekistan</name><population>24318000</population></country><country><name>Vanuatu</name><population>190000</population></country><country><name>Venezuela</name><population>24170000</population></country><country><name>Vietnam</name><population>79832000</population></country><country><name>Virgin Islands, British</name><population>21000</population></country><country><name>Virgin Islands, U.S.</name><population>93000</population></country><country><name>Wallis and Futuna</name><population>15000</population></country><country><name>Western Sahara</name><population>293000</population></country><country><name>Yemen</name><population>18112000</population></country><country><name>Yugoslavia</name><population>10640000</population></country><country><name>Zambia</name><population>9169000</population></country><country><name>Zimbabwe</name><population>11669000</population></country></countries>
Doba běhu: 350.1 ms
Please observe that the result of both previous scripts looks the same on this page. To see the difference, you need to download the sources and run them for yourself (at best in Firefox).