随笔分类 - Python基础
此处整理了Python的基础知识
摘要:import matplotlib.pyplot as plt plt.plot([3, 1, 4, 5, 2]) #只有一个输入列表或数组时,参数被当做Y轴,X轴以索引自动生成 plt.ylabel("Grade") plt.savefig('test', dpi=600) #记录为PNG文件 p
阅读全文
摘要:# -*- coding: utf-8 -*- """ Created on Sat Jan 8 10:20:12 2022 求年支 @author: Administrator """ n = int(input('请输入阳历年:')) print(n) n1 = (n-3) % 10 #取余数
阅读全文
摘要:数字 a1=123 a2 = 456 整形 int 将字符串转换为数字int() 以x进制进行转换int(a, base=x) .bit_length()方法:当前数字的二进制,至少用n位表示 浮点型 float 字符串str 首字母大写.capitalize() 变小写.casefold(), .
阅读全文
摘要:1 name = "郑建文" 2 3 # "郑建文" 字符串 4 # "郑" 字符 5 # "建文" 子字符串, 子序列 6 7 if "建文" in name: 8 print("OK") 9 else: 10 print('Error') PYcharm中整体注释:ctrl + ? if "建文
阅读全文
摘要:代码块 if 1 == 1: print("") print("") # TAB else: print("") if 1==1: print("") print("") print('end') 可以嵌套: 1 if 1 == 1: 2 if 2 == 2: 3 print("") 4 print
阅读全文
摘要:一、Linux基础 计算机以及日后程序放置的服务器的简单操作 二、Python开发 Python基础基础1.第一句python - 后缀名可以是任意 -导入模块时,如果不是.py文件,会出错 ==>以后文件后缀名是py2.两种执行方式 python解释器 py文件路径 python 进入解释器: 实
阅读全文

浙公网安备 33010602011771号