Tutorial Python untuk bukan pengatur cara/FAQ

Daripada Wikibooks
Pergi ke pandu arah Pergi ke carian
Soalan: Tidak dapat menggunakan program dengan input.
Jawapan: Jika anda mengguna IDLE, cuba guna garis perintah. Masalah ini nampaknya sudah ditangani dalam IDLE 0.6 dan yang lebih baru. Jika anda mengguna IDLE versi yang lama, cuba naik taraf perisian anda kepada Python 2.0 atau yang lebih baru.
Adakah versi yang dapat dicetak?
Ya, lihat soalan berikut.
Adakah terdapat versi PDF atau zip?
Ya, pergi ke http://www.honors.montana.edu/~jjc/easytut untuk mendapatkan beberapa versi. Sila maklum bahawa versi-versi di sana tidak dikemas kini seperti versi Wikibuku. Wikibuku boleh dicetak daripada versi cetak.
Dengan perisian apakah tutorial ini ditulis?
Asalnya dengan LaTex, lihat fail easytut.tex.
Saya tidak dapat menaip program yang melebihi satu baris.
Jika program yang anda taip itu terlaksana sebaik sahaja anda menaipnya, anda perlu sunting fail dan tidak menaip kod ke dalam pentafsir interaktif. (Bayangan: mod interaktif ialah mod yang mempunyai prom >>> di hadapannya.)
My question is not answered here.
Ask on the talk page. Please post source code if at all relevant (even, (or maybe especially) if it doesn't work). Helpful things to include are what you were trying to do, what happened, what you expected to happen, error messages, version of Python, Operating System, and whether or not your cat was stepping on the keyboard. (The cat in my house has a fondness for space bars and control keys.)
I want to read it in a different language.
There are several translations that I know of. One is in Korean and is available at http://home.hanmir.com/~johnsonj/easytut/easytut.html. Another is in Spanish and at http://www.honors.montana.edu/~jjc/easytut/easytut_es/. Another is in Italian and is available at http://www.python.it/doc/tut_begin/index.html. Another is in Greek and available at http://www.honors.montana.edu/~jjc/easytut/easytut_gr/. Several people have said they are doing a translation in other languages such as French, but I never heard back from them. If you have done a translation or know of any translations, please either send it to me or send me a link.
How do I make a GUI in Python?
You can use either TKinter at http://www.python.org/topics/tkinter/ or WXPython at http://www.wxpython.org/
How do I make a game in Python?
The best method is probably to use PYgame at http://pygame.org/
How do I make an executable from a Python program?
Short answer: Python is an interpreted language so that is impossible. Long answer is that something similar to an executable can be created by taking the Python interpreter and the file and joining them together and distributing that. For more on that problem see http://www.python.org/cgi-bin/faqw.py?req=all#4.28. A project that does make executable python files is py2exe - see http://www.py2exe.org.
I need help with the exercises
Hint, the password program requires two variables, one to keep track of the number of times the password was typed in, and another to keep track of the last password typed in. Also you can download solutions from http://www.honors.montana.edu/~jjc/easytut/
What and when was the last thing changed?
  • 2000-Dec-16, added error handling chapter.
  • 2000-Dec-22, Removed old install procedure.
  • 2001-Jan-16, Fixed bug in program, Added example and data to lists section.
  • 2001-Apr-5, Spelling, grammar, added another how to break programs, url fix for PDF version.
  • 2001-May-13, Added chapter on debugging.
  • 2001-Nov-11, Added exercises, fixed grammar, spelling, and hopefully improved explanations of some things.
  • 2001-Nov-19, Added password exercise, revised references section.
  • 2002-Feb-23, Moved 3 times password exercise, changed l to list in list examples question. Added a new example to Decisions chapter, added two new exercises.
  • 2002-Mar-14, Changed abs to my_abs since python now defines a abs function.
  • 2002-May-15, Added a faq about creating an executable. Added a comment from about the list example. Fixed typos from Axel Kleiboemer.
  • 2002-Jun-14, Changed a program to use while true instead of while 1 to be more clear.
  • 2002-Jul-5, Rewrote functions chapter. Modified fib program to hopefully be clearer.
  • 2003-Jan-3, Added average examples to the decisions chapter.
  • 2003-Jan-19, Added comment about value of a_var. Fixed mistake in average2.py program.
  • 2003-Sep-5, Changed idle instruction to Run->Run Module.
  • 2004-Jun-1, Put on Wikibooks
  • Since then all changes are visible through the Wikibooks version keeping system.