Sophia_sugar

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

2016年8月20日

摘要: python3中没有long int类型 布尔类型: 1:真;0:假 >>> 0 == True False >>> 0 == False True >>> 1 == True True >>> 1 == False False 万恶的字符串拼接: python中的字符串在C语言中体现为是一个字符数 阅读全文
posted @ 2016-08-20 23:16 Sophia_sugar 阅读(117) 评论(0) 推荐(0)

摘要: 1. Python是一门解释型语言? 我初学Python时,听到的关于Python的第一句话就是,Python是一门解释性语言,我就这样一直相信下去,直到发现了*.pyc文件的存在。如果是解释型语言,那么生成的*.pyc文件是什么呢?c应该是compiled的缩写才对啊! 为了防止其他学习Pytho 阅读全文
posted @ 2016-08-20 23:15 Sophia_sugar 阅读(150) 评论(0) 推荐(0)

摘要: 有一种循环叫死循环,一经触发,就运行个天荒地老、海枯石烂 1 #coding=utf-8 2 count=0 3 while True: 4 print("你是风儿我是沙,缠缠绵绵到天涯。。。",count) 5 count+=1 View Code 1 #coding=utf-8 2 count= 阅读全文
posted @ 2016-08-20 23:13 Sophia_sugar 阅读(133) 评论(0) 推荐(0)

2016年8月14日

摘要: 1、guess_age优化版v1.py 1 #coding=utf-8 2 age = 22 3 4 for i in range(10): 5 if i < 3: 6 guess_num = int(input('input your guess num:')) 7 if guess_num == 阅读全文
posted @ 2016-08-14 11:34 Sophia_sugar 阅读(100) 评论(0) 推荐(0)

摘要: 1、if.py 1 #coding=utf-8 2 user = 'alex' 3 passwd = 'alex3714' 4 5 username = input('username:') 6 password = input('password:') 7 8 if user == usernam 阅读全文
posted @ 2016-08-14 11:32 Sophia_sugar 阅读(117) 评论(0) 推荐(0)

摘要: 1、raw_input python2.7用户输入字符串的话用raw_input。如果使用input输入字符串的话需要先把字符串放到变量中才可,但是用input输入数字的话是可以直接输入的,所以说在python2.x中只用raw_input >>> user_input=raw_input("you 阅读全文
posted @ 2016-08-14 11:19 Sophia_sugar 阅读(1241) 评论(0) 推荐(0)

摘要: 1、windows 在d:/python35_study目录下创建hello.py文件,内容如下: 1 print ('Hello World') View Code 1 print ('Hello World') 在cmd下执行进入d:/python35_study目录,执行python hell 阅读全文
posted @ 2016-08-14 10:53 Sophia_sugar 阅读(111) 评论(0) 推荐(0)