Tag Archives for editra

Learning Python 1

I’m learning python these days. I’ve set up two projects in google code: dicthon , a Chinese-English and English-Chinese dictionary based on dict.cn. Huahua has writen a script for me. It works perfect, it is my default dictionary now. You can download it from the project site. I’m planning to add some more functions in it, such as “read the word”, “my new words”. The second is tuvio, a violin tuner, I need to read some guitar tuners.

I have the ideas, now I need to make them into practice. However, I’m just a beginner, and there are not so many exercises for beginners. So I picked up some exercises and algorythms in C , and rewrite them by python.

And I’ll recommend another editor Geany, it’s just wonderful, better than editra I introduced before. It can complie and run the script, I could say it’s a lightweight IDE. I’m so bad at vim, and eclipse is too powerful for me, geany just fits well.

Now, it is my first exercise:

Input 2 integers from the keyboard, and print out their sum.

#!/usr/bin/python
# Filename : sum.py
x = int(raw_input(”Please enter a integer for x : “))
y = int(raw_input(”Please enter a integer for y : “))
sum = x + y
print “The sum of x and y is “, sum
print “The sum of x and y is “, x+y #You can either declare a new variance or just sum them up.

Run the script:

Please enter a integer for x : 9
Please enter a integer for y : 78
The sum of x and y is  87
The sum of x and y is  87

What did I learn?

  1. Of course, how to run python: first line of the script; file extension; python filename
  2. How to get input from keyboard: raw_input( ” What ever you want to say ” )
  3. There’s no need to use comma, but if more than one command in one line, you need to use comma. I used to use it in Perl and C :)

Changed My Linux to Xubuntu

Today, I just changed my Linux desktop to Xubuntu. Xfce is claimed as the lightweight desktop environment for old computers with small memory and stuff… My computer is rather new, just has been used for less than 1 year, but I’m so tired of waiting for response as it was in windows.

It was hard work, first my internet didn’t work, then my SUDO didn’t work, but now everything is fine, so pround myself, don’t you think that I worth it?

Haven’t found a way to change Thunar to Pcmanfm. They are both light weight file browsers, but only Pcmanfm has the tab feature, the one I really need, googled a lot, no tab feature for Thunar and Nautilus either. Pcmanfm is my only choice.

I also found a great text editor — Editra, it has all the features I want, especially the code folding.

Great great, I love opensource, hope I can do something for the OpenSource.

It’s all for today, goodnight!