Oracle, Web, Script, SQLserver, Tips & Trick

December 16, 2017

How to convert xml into text file [python]

Filed under: phyton — sikathabis @ 10:51 am
Tags: , ,

import xml.etree.ElementTree as ET
tree = ET.parse(‘test.xml’)
notags = ET.tostring(tree.getroot(), encoding=’utf-8′,method=’text’)
f = open(‘test.txt’,’w’)

reference : link1 | link2

April 22, 2012

Membuat directory secara increment menggunakan python 3.2

Filed under: phyton — sikathabis @ 4:52 pm
def buatdir(dirfname):
        except OSError as info:
            if ‘[Errno 13]’ in info2[0]: #(info2=='[Errno 13] Permission denied’)
                while (err==“True”):
                    except OSError as info3:
                        if ‘[Errno 2]’ in info2[0]: #=='[Errno 2] No such file or directory’: #bisa dibuat directorynya
                if err==“False”:
                    print(‘\nExecution / script file store in folder %s\n’ % dirfname)
                    return dirfname
            elif ‘[Errno 2]’ in info2[0]: #info=='[Errno 2] No such file or directory’: #bisa dibuat directorynya
                print(‘Execution / script file store in folder %s\n’ % dirfname)
                return dirfname

March 30, 2012

Install Python 3.2 on Linux [Ubuntu]

Filed under: linux,phyton — sikathabis @ 6:36 am
Tags: ,

links :

First of all, I don’t see a point to show you how to install Python on Windows. It’s dead easy download the installer from and in few clicks you will have python up and running. Installing Python on Linux is bit different and requires some pre-work to be done.
So Let’s get started.

Note: Every Modern Linux had a python Installed. You can verify this by opening your Terminal and typing python. It will open the python shell for you. Do not remove the installed version.

Step 1: Pre-requisites for Ubuntu

To be able to compile Python Source, you will need few packages. Fire up the terminal and execute this command

sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev

It will take some time to finish depending upon your bandwidth. 🙂

Step 2: Downloading Python Sources and extracting them on your disk

Download a tarball from the python site here is a direct link. Once, the download is completed you can extract the files by doing a right-click on the file and then clicking the extract option


Fire up the terminal and execute this command which will download the file first and extract it on the disk.

wget && tar -xvf Python-3.2rc2.tgz

Step 3: Installing Python 3.2

Fire up a new Terminal and execute the following commands individually.

1.   ./configure
2.   make
3.  sudo make altinstall

February 14, 2012

Google python class with Nick Parlante (text version)

Filed under: phyton — sikathabis @ 10:01 am

Day 1 part 1

C:\Python32>python asdasd vsdf dfdf
[‘’, ‘asdasd’, ‘vsdf’, ‘dfdf’]

C:\Python32>python asdasd vsdf dfdf
File “”, line 5
def Hello(name) {
SyntaxError: invalid syntax

C:\Python32>python asdasd vsdf dfdf
File “”, line 8
SyntaxError: invalid syntax

February 13, 2012

cx_oracle for python

Filed under: oracle,phyton — sikathabis @ 10:42 pm
Tags: ,

cx_Oracle is a Python extension module that allows access to Oracle databases and conforms to the Python database API specification. This module is currently built against Oracle 9.2, 10.2, 11.1 and 11.2. For more information on the database API specification, see here. Use the provided to build and install the module which makes use of the DistUtils module made available in Python 2.0 and up.

If you are looking for support with Tuxedo servers, go here.

Download 5.1.1 released October 10, 2011

August 14, 2011

I’ve no idea how can one go about writing a DSL in Python

Filed under: phyton — sikathabis @ 7:03 am
Tags: , ,


There’s multiple definitions, so what follows is not authoritative, but in my hummble opinion it will help you understand the field much better, as well as why so many people seem to be talking past each other as they silently adopt one definition while arguing with someone based on another.

A strong DSL is a specialized language designed for a specific task, with its own parser and syntax not directly based on another language. Ideally, it is not Turing complete, because that opens a huge can of worms, and much of the point of a strong DSL is to avoid this can of worms. The DSL should be carefully designed in conjunction with the eventual users, who most likely will not be programmers. I’ve heard of impressive results with this approach, but I’ve never witnessed them firsthand. This definition is favored by Martin Fowler, and much less importantly/impressively, me.


Ruby-style DSL’s in Python 2.5

Filed under: phyton — sikathabis @ 6:45 am
Tags: , ,
## {{{ (r1)
from __future__ import with_statement
from contextlib import contextmanager

class Table(object):
    def __init__(self, table_name):
        self.table_name = table_name
        self.fields = {}

    def __setattr__(self, attr, value):
        if attr in ("fields", "table_name"):
            object.__setattr__(self, attr, value)
            self.fields[attr] = value

    def execute(self):
        print "Creating table %s with fields: %s" % (self.table_name, self.fields)

def create_table(table_name):
    yield table

#try it!
with create_table("Employee") as t:
    t.first_name = {"type" : "char", "length" : 30 }
    t.last_name = {"type" : "char", "length" : 30 }
    t.age = {"type" : "int"}

#Creating table Employee with fields: {'first_name': {'length':
#30, 'type': 'char'}, 'last_name': {'length': 30, 'type': 'char'}, 'age':
#{'type': 'int'}}
## end of }}}

July 16, 2011

Writing a domain specific language DSL with python

Filed under: phyton — sikathabis @ 5:14 am

Writing a domain specific language DSL with python

A domain-specific language is a piece of software designed to be useful for a specific task in a fixed problem domain, they’re gaining popularity because they enhance productivity and reusability of artifacts. DSLs also enable expression and validation of concepts at the level of abstraction of the problem domain, this approach is very useful when you need to describe a user interface, a business process, a database, or the flow of information.


March 9, 2011

Satu Hari bermain dengan IDLE

Filed under: phyton — sikathabis @ 7:38 pm

(Indonesian translation by I Wayan Wandira)

Halaman ini dimaksudkan untuk membantu pendatang baru di Python yang merasa sedikit bingung. Satu pertanyaan yang sering muncul adalah : Ok, saya sudah menginstall Python….ummm… sekarang bagaimana ?

Mungkin akan lebih bagus sebuah arahan secara “visual” digunakan untuk mengurangi kegelisahan yang timbul. Itulah sebabnya kenapa halaman ini dibuat. Adapun langkahnya adalah dengan melakukan sebuah sesi kecil dengan IDLE : Lingkungan Pemrograman Python yang Terintegrasi. IDLE didesain untuk menyediakan cara singkat mempelajari bahasa ini. Pada sesi ini, saya akan membuat beberapa kesalahan, hanya untuk menunjukkan bahwa apakah sebenarnya yang terjadi ketika sesuatu tidak berjalan sebagaimana mestinya.

Berhubung ini adalah dokumen online. Jika anda punya beberapa saran, atau jika anda ingin mengkoreksi atau memperbaiki silahkan kirim email ke : jangan lupa bahwa ada sumber referensi di mailing list Python tutor. Kami adalah sekelompok orang yang saling berbagi hal hal menarik tentang Python. Kita akan belajar bersama , jadi silahkan subscribe dan bergabung bersama kami.


November 24, 2010


Filed under: phyton — sikathabis @ 9:48 pm
- Format Angka
'{:1,.2f}'.format(123.0) menjadi '123.00'
'{:7,.1f}'.format(123.0) menjadi ' 123.0'
'{:8,d}'.format(123.0) menjadi '1,200.00'

import sys
try:     f = open('myfile.txt')     s = f.readline()     i = int(s.strip()) except IOError as (errno, strerror):     print "I/O error({0}): {1}".format(errno, strerror) except ValueError:     print "Could not convert data to an integer." except:     print "Unexpected error:", sys.exc_info()[0]     raise

Blog at



Teknologi Pendidikan

Just another weblog


Jurnalisme Yang Dapat Dipercaya

Tonk Kosonk Baonk Bunyinya

Penampungan Serapah Tanpa Sumpah

Qey050489's Blog

Ayo Bangkit sobat..!!!!!

B. S. Totoraharjo

Orang Desa Yang Mencintai Desa dan Kebudayaannya

culturekitchen foodlab

New Food and Art in Yogyakarta

Wahyu Catur Wibowo

Musafir Dunia Maya

SQL.... Still Learning

My Reference on SQL Server


"Tuhan tidak menuntut kita untuk menang. Tuhan hanya meminta kita untuk berjuang tanpa henti.” -ean-


Street Photography is like a box of a chocolates, you're never know what you're gonna get - Thomas Leuthard -

Be a good Moeslim

Menuju Pribadi Muslim Sejati yang Bertaqwa


Manajemen Sholat, renungan spiritual, Teknologi Informasi

Pelangi di khatulistiwa....

Mari berbagi kebaikan, pengalaman dan senyum denganku


Ceritanya saya, Pikirannya saya, Hatinya saya


sikathabis semua informasi disini