Articles tagged with python

  1. Tools for generating PDFs from django.

    For a Django project i’m working on i needed to generate PDF reports. For example a “job ticket” that displays the client data, the material list and a list of “processing” actions to be performed, or an invoice (classic use case).

    What i wanted was a way to generate …

  2. Τρικ στρογγυλοποίησης ακεραίων στην Python

    Στην Python για στρογγυλοποίηση αριθμών υπάρχει η build-in function round().
    Η round(number,[ndigits]) παίρνει ένα αριθμό και επιστρέφει ένα float αριθμό στρογγυλοποιημένο. Αν δώσουμε το όρισμα ndigits (αριθμός παλι) η στρογγυλοποίηση γίνεται στα ndigits ψηφία. Πχ.
    >>> round(1.123456,3)
    1.123
    

    Ο αριθμός στρογγυλοποιήθηκε στα 3 δεκαδικά ψηφία …
  3. PyMOTW and stuff

    Ίσως το καλύτερο blog σχετικά με Python.

    Ο Doug Hellmann έχει στο blog του μια κατηγορία που την ονομάζει PyMOTW - δηλαδή Python module of the week.

    Κάθε εβδομάδα έχει ένα αναλυτικότατο, απόλυτα κατανοητό με πολλά παραδείγματα αφιέρωμα σε ένα module της Python.

    Είναι must read. Ακόμα και σε modules που …

  4. Python list comprehensions nasty behavior

    Python’s list comprehension syntax is amazingly concise and easy to use and understand. It make Python even more beautiful than it already is.

    However, i came upon some weird behavior today that caused a strange bug in my application.

    The common way to use a list comprehension is with …

  5. sorting using keys in python.

    I’ve used comparator functions while sorting in python quite often. I had a complex object today that i had to sort on using non-standard comparator functions.

    My object was a dictionary that contained a list of 2 dictionaries that in turn containd lists of objects. I wanted to sort …

  6. Resolver is a great idea.

    I was reading about Resolver quite often, mostly on planet python. I had made a mental memo to try it out for my self sometime but always seemed to be delaying it. I tried it out yesterday i was really impressed by the concept. 

    With Resolver you have a spreadsheet …

  7. IBAN validating code

    Recently i needed to validate some IBAN numbers (International Bank Account Number). I quick search revealed the wikipedia article on the subject.

    Though i had initially hacked up a Greek-only IBAN validator i though it might be of use to other people as well and modified it to validate  every …

  8. Captcha widgets in Django

    This blog was getting stormed by comment spam so i decided to use some captcha protection. I chose pycaptcha for this and had to integrate it nicely with Django. I wanted to make it an easy widget that does it’s own validation and does not require view code for …

Page 1 / 2 »