python
文章平均质量分 58
xinghua24
这个作者很懒,什么都没留下…
展开
-
Learning Python(3) Object Types
Everything is an Object. But some are more common than others, We usually call the objects below Core Data Objects: Object type Example literals/creation Numbers原创 2012-07-14 23:49:40 · 523 阅读 · 0 评论 -
Learning Python(2) input([prompt])
input([promt]) gets the input from command line and return the text example: input('Press Enter to exit') >>> text = input( "enter some text: " ) enter some text: good >>> print( text ) good I原创 2012-07-14 01:33:46 · 1198 阅读 · 0 评论 -
Learning Python(6) Dictionary
Dictionary are not sequence, they are called mappings. Initialization When written as literals, dictionaries are coded in curly braces and consist of a series of “key: value” pairs. D = {'S':原创 2012-07-24 11:58:38 · 340 阅读 · 0 评论 -
Learning Python(5) Sequence type(lists, tuples, strings)
common operations: len(s) length of s min(s) smallest item of s max(s) largest item of s x in s 1 if an item of s is equal to x, else 0 x not in s 0 if an item of s is equal to x, else原创 2012-07-24 11:42:40 · 318 阅读 · 0 评论 -
Learning Python(1) How python program runs
Module Reference java2s Reference 2.7 Quick Reference An interpreter is a kind of program that executes other programs. The python code runs on an interpreter Run a sample program 1.原创 2012-07-13 20:55:02 · 433 阅读 · 0 评论 -
Learning Python(7) Files
write: f = open('data.txt', 'w') f.write('Hello\n') f.write('world\n') f.close() read: f = open('data.txt') text = f.read() print(text) print( text.split()) #Hello #World #['Hello', 'world']原创 2012-07-24 21:45:38 · 255 阅读 · 0 评论