Python学习
文章平均质量分 80
zcliatb
这个作者很懒,什么都没留下…
展开
-
Python data structure
1. append(x) = > a[len(a):] = [x], extend(L) => a[len(a):] = L, insert(i,x) # before i, remove(x) # remove x or return error, pop([i]) # default value is the last element原创 2014-12-26 09:30:09 · 1038 阅读 · 0 评论 -
Python data type
1. unix ctrl+d,windows ctrl +z or import sys; sys.exit();2. int, float, complex number(real,imag,abs), _ represent last mentioned number, string(\",\n\, r" " \n doesn't work, quotation can cross-re原创 2014-12-25 14:25:49 · 590 阅读 · 0 评论 -
Python module
1. module name fibo.__name__ # file fibo.py def f(x): return x*x import fibo fibo.f(10) # module name then function name fl = fibo.f # to make it call like locally原创 2014-12-26 14:14:12 · 499 阅读 · 0 评论 -
Python input and output
1. output a. string b. %=>like printf2. str(make a string) or repr(convert for interpreter) 'the value is x = ' + repr(x) + 'the value is y = ' + repr(y) The repr() of a string adds原创 2014-12-26 16:32:48 · 566 阅读 · 0 评论 -
Python - syntax errors and exception
1. syntax errors (arrow marks)2. zero division error, name error, type error.3. try except while True: try: x = int(raw_input("Input:"))原创 2015-01-04 21:21:44 · 916 阅读 · 0 评论 -
Python - class
c++ & python modula-3a basic class:class ClassName: . . . it will generate a new namespaceclass MyClass: "A simple example class" i = 12345 def f(sel原创 2015-01-25 16:18:56 · 737 阅读 · 0 评论 -
django-simple-captcha & jquery validate
1. view.pyfrom django.shortcuts import renderfrom django.http import HttpResponseRedirect, HttpResponseimport jsonfrom django import formsfrom captcha.fields import CaptchaFieldclass Nam原创 2015-07-07 16:35:27 · 889 阅读 · 0 评论 -
django-simple-captcha refresh & validation
PreparationDownload django-simple-captcha using pip by running: pip install django-simple-captchaAdd captcha to the INSTALLED_APPS in your settings.pyRun python manage.py syncdb (or py原创 2015-07-06 18:40:34 · 1279 阅读 · 0 评论