Python基础03_pycharm

pycharm的安装还是很简单的,一路next。

看起来Jet Brains 家的产品长相都差不多啊。

主要是create new project时,路径和解释器的选择,我电脑上有2.7和3.6 所以要选择一下interpreter

File >> settings >> Editor >> Gerneral  勾上change font size(Zoom)... 就可以直接按住Ctrl 滚鼠标轮子放大或缩小字体了。这一点和office软件相同。

 而 Editor >> File and Code Templates 则可以自定义某种脚本的模板。 比如我们在python script里加上常用的文件头。

业余时间的学习,主要是时间不够。因为每天早起6:20要做全家人的早餐。所以晚上搞到23点就已经很困了,如果不睡,第二天就会感觉不舒服。

以下是今天的几个练习整理:

#!/usr/bin/env python
# coding:utf-8

#基本运算符 + - * / %   **   //
#  in      not in  这基本上和SQL中的一样。
# 字符串  以及  子字符串,也叫子序列。
name = "摩瑞尔"

if "" in name:
    print("在的")
else:
    print("没在")

if "摩尔" in name:
    print("词语也在")
else:
    print("不在")

# 选中,Ctrl + ? 可以全部注释,或全部取消注释。

if "" not in name:
    print("not in here")
else:
    print("yes")
#!/usr/bin/env python
# coding:utf-8

# 算术运算符的简写
# n += 1   #  -+   *=    /+    %=    **=   //=

# 逻辑运算符的执行顺序是从左到右。有括号时则最先。
# 结果:
#     True OR >> true
#     True AND >> 继续
#     False or >> 继续
#     False AND >> false

# 算术运算 & 赋值运算  都属于结果是真实的值
s = 3 ** 4
print(s)

# 比较 、逻辑、 成员 运算符 都属于结果是布尔值
a = 2 > 3
print(a)

b = 1 > 6 or 3 == 3
print(b)

v = "" in "中国"
print(v)

w = not False
print(w)
#!/usr/bin/env python
# coding:utf-8

# 基本数据类型: 整型 int 、 字符串 str 、 布尔值 bool 、 列表 list 、 元组 tuple 、 字典 dict
# Python3里所有数字都是整型。 int
# python2里有取值范围,分为int / long 等,
# 输入类型名称后,按ctrl键点击,可查看定义。
#数字比作猎人
n = 123
v = n.bit_length()
print(v)

#字符串比作女巫
a = 'atlas'
a = a.upper()
print(a)

b = 'Hadoop Hive'
b1 = b.lower()
print(b1)
#!/usr/bin/env python
# coding:utf-8

# 数字 int 的几种方法
#    -int 转换
n = "1234"
print(type(n),n)

m = int(n)
print(type(m),m)

u = "0011"
v = int(u,base=2) # 基于二进制转换
w = int(u,base=10)
x = int(u,base=16)
print(u,'------',w,'===',x)

#    -bit_length当前的数字最少的二进制表示位
age = 7
a1 = age.bit_length()
print(a1)

  

原文地址:https://www.cnblogs.com/frx9527/p/pycharm.html