web.py nginx-egaz erabiltzeko fastcgi moduen spawn-fcgi-gaz debian gnu/linux-en

Instalaziñue: su aptitude install nginx-full spawn-fcgi python-pip pip install web.py exit Proiektuentzako karpeta bat sortu, adibidez: mkdir /home/projects/zpy mkdir /home/projects/zpy/private mkdir /home/projects/zpy/public mkdir /home/projects/zpy/public/static touch /home/projects/zpy/private/zpy.py Haulako estrukturie okingo lekidau: . ????????? private ???   ????????? zpy.py ????????? public ????????? static Oin python-en script-e fcgi moduen erabiltzeko: nano /home/projects/zpy/zpy.py #!/usr/bin/env python # -*- coding: utf-8 -*- […]

php array multi-dimensional bat python dict bihurtu

Ba hamen gabilz barriro python-egaz pellikan, oingutan php-tik curl bidez botaku array multi-dimensional bat post edo get bidez eta python-egaz hartun. Okin biharrekuek: python, web zerbitzaridxe php-gaz eta cgi-gaz Paketiek instala: su aptitude install python-pip php5-curl pip install querystring-parser exit curl.class.php artxibue: <?php class curl { public static function getURL($url, $params = array(), $type = […]

debian / python: sqlalchemy -gaz oracle -ra konekta

Paketiek instala: su aptitude install python-sqlalchemy alien libaio1 exit Jakitzeko ze bertsiño dakun python-ena: python -V erantzune: Python 2.7.2+ Jakitzeko oracle-n bertsiñue: select * from product_component_version; erantzune: NLSRTL                                  11.2.0.2.0 Production Oracle Database 11g Enterprise Edition  11.2.0.2.0 64bit Production PL/SQL                                  11.2.0.2.0 Production TNS for 64-bit Windows:                 11.2.0.2.0 Production Nire kasuen: python 2.7 eta oracle 11.2 Orduen […]

python: gaurko erabiltzaile batzun tweet-ek wordpress-en publike

Hamen azken fiñien script-e akabata #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import urllib import datetime as date import time import simplejson as json import re import MySQLdb def getTweets(id):     now = date.datetime.now().strftime(“%Y-%m-%d”)     url = “http://search.twitter.com/search.json?q=+from%3A”+u+”+since%3A”+now     json_text = urllib.urlopen(url).read()     json_obj = json.loads(json_text)     tweets = []     for result […]

python: adierazpen erregularrakaz (regex) link-ek html-ra bihurtu

baguez kallue hartzien python-eri, oingutan texto batetik link-ek html-ra pasa’kuz #!/usr/bin/env python # -*- coding: utf-8 -*- import re text = “http://aaaaa       https://bbbbb ftp://ccccc\n http://dddddddd” m = re.sub(r'(?i)(^|\s+|\A)(http|https|ftp)(\://\S+)(\s+|\Z|$)’, ‘\\1<a href=\”\\1\\2\” onclick=\”window.open(this.href); return false;\”>\\2\\3</a>\\4’, text) print m Erantzune:   <a href=”http://aaaaa” onclick=”window.open(this.href); return false;”>       <a href=”https://bbbbb” onclick=”window.open(this.href); return false;”> <a href=”ftp://ccccc” onclick=”window.open(this.href); return false;”>  <a href=”http://dddddddd” […]