摘要:http://www.cnblogs.com/fnng/p/3565912.html
阅读全文
摘要:https://docs.python.org/3/tutorial/index.htmlhttps://docs.python.org/3/library/index.html#https://docs.python.org/3/reference/index.htmlhttp://blog.cs...
阅读全文
摘要:Standard LibraryOSimport osos.getcwd()os.chdir("/home/andy")os.system("mkdir today")>>> import shutil>>> dir(shutil)['Error', 'ExecError', 'ReadError'...
阅读全文
摘要:Classes__author__ = 'andy'def scope_test(): def do_local(): spam = "local spam" def do_nonlocal(): nonlocal spam spam = "no...
阅读全文
摘要:Errors and ExceptionsSyntax ErrorsExceptionsHandling Exceptionswhile True:... try:... x = int(input("Please enter a number: "))... ...
阅读全文
摘要:ModulersA module is a file containing Python definitions and statements. The file name is the module name with the suffix.pyappended. Within a module,...
阅读全文
摘要:listcount(item)返回item的出现次数insert(index,x)在位置index插入xappend(item)在尾部添加itema = [66.25, 333, 333, 1, 1234.5]>>> print(a.count(333), a.count(66.25), a.cou...
阅读全文
摘要:An Informal Introduction to Python¶https://docs.python.org/3/tutorial/index.htmlNumbers>>> 17/35.666666666666667>>> 5 ** 225>>> 5**225>>> 17//35String...
阅读全文
摘要:__author__ = 'andy'#!/usr/bin/python3.2# -*- coding: utf-8 -*-from urllib.request import urlopenimport http.clientimport jsonimport osimport timebaseU...
阅读全文
摘要:open('filename')file('filename','mode')mode:a,w,r,a+,w+,r+methods:readline(),readlines()write('')seek(n)truncate(n)
阅读全文
摘要:split(),join()函数Listcount(''),index('')append(''),insert(index,item),extend('')remove(''),pop(index),pop()sort()if item in List: print itemtuplecount(''),index('')del tupleDictionaryPhone = {'alex':'135','ch':'136
阅读全文
摘要:1 for i in range(1,10,2): 2 print 'my number is ', i 3 if i == 5: 4 print 'got it!' 5 break 6 else: 7 print 'class is dismiss' 8 9 10 while True:11 input = int(raw_input('input code:'))12 if input == 5:13 print 'success'14 elif input == 0:15 ...
阅读全文