![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
cocos2d-x中游学院
수 현 ,cocos2dx,swift
展开
-
【python】文件操作
文件也是python的类型之一file = open ("jeapedu.text","w")open 是python的内置函数, 参数1,是要打开的文件名字。 参数2,是打开的模式,有读、写、追加等。返回的类型就是文件类型。参数2,mode类型的解释"w" , 可以写,如果不存在就新建立; 如果存在并且有内容,会如何? 请看稍后的实验。"r", 打开读文件内容原创 2013-11-17 15:40:50 · 1006 阅读 · 0 评论 -
【Python】list用法及其常见错误
python 里面有一个非常强大的数据类型list。他什么都能装下。peter@智普教育:~$ pythonPython 2.7.3 (default, Aug 1 2012, 05:16:07) [GCC 4.6.3] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> l1原创 2013-11-17 15:01:19 · 1235 阅读 · 0 评论 -
【python】列表的复制问题
python开发面试题,列表的复制问题In [14]: import copyIn [15]: b = [1,2,[3,4]]In [16]: a = b[:]In [17]: a[2][0] = 100In [18]: bOut[18]: [1, 2, [100, 4]]In [19]: aOut[19]: [1, 2, [100, 4]]In [20]: a1 = copy原创 2013-11-17 15:35:43 · 809 阅读 · 0 评论 -
【python】dict使用方法和快捷查找
字典的用法,dict的查找特别快捷。如果我们的项目经常用到搜索某些数据,最好用dict类型。认识dict¶peter@智普教育:~$ pythonPython 2.7.3 (default, Aug 1 2012, 05:16:07) [GCC 4.6.3] on linux2Type "help", "copyright", "credits" or "license" for m原创 2013-11-17 15:38:38 · 3182 阅读 · 0 评论 -
【python】字符串的用法阶进
字符串的格式¶s1= r'abcd' #raw,原始数据s2= u'abcd' #unicode 数据他们的区别:s1= r'\nabcd's2= u'\nabcd'print s1print s2print len(s1)print len(s2)如何让字符串中含有引号 ",'s3=""" """S3= """ hello,say:'world'..."""内置函数原创 2013-11-17 15:42:14 · 849 阅读 · 0 评论 -
【python项目】扩展---公交换乘
项目要求:用户输入起点,再输入终点站。 我们程序根据 公交站的字典查找到换乘的位置。我们程序要:提示 换乘站 和换乘路线。公交数据库如下:375:西直门,文慧桥,蓟门桥,学院路,知春路562:蓟门桥,学院路,中关村387:学院路,北京西站jiangning@jiangning-Ideapad-Z460:~$ more bus.txt 375:西直门,文慧桥,蓟门桥,学院路,知春路562:蓟原创 2013-11-17 15:46:44 · 2041 阅读 · 0 评论