随笔分类 - Python
python基础知识
    
摘要:字典内置函数&方法 函数: 1.len(dict1):打印字典的键的个数 方法:dict1.( ) 2.clear():清空字典 3.copy():复制字典 4.fromkeys():使用指定的序列作为键创建字典 list1,list2 =["d","e","f"],[1,2,3,4,5] list
        阅读全文
            
摘要:python之内置函数 1.map(func,lsd): 将序列lsd里的元素依次作用在函数func上,map是一个惰性序列,需要用list转化才能打印出结果 print(list(map(func,lsd))) 2.filter(func,lsd): 将lsd序列的里元素依次作用在func上返回b
        阅读全文
            
摘要:from threading import Threadfrom socket import *# 定义发送消息的函数def sendmsg(s,sendip,sendport): while True: # 获取用户输入的发送内容 content = input('<<') # 发送;转换编码,i
        阅读全文
            
摘要:python之虚拟环境 虚拟环境管理包:virtualenvwrapper virtualenvwrapper 时一个基于virtualenv之上的工具,它将所有的虚拟环境统一管理。 1.安装: pip install virtualenv pip install virtualenvwrapper
        阅读全文
            
摘要:python之OS模块 首先导入os模块 :import os 1、os.name :正在使用的操作平台 windows是:nt linux是:posix 2、os.getcwd():获取当前工作路径 1、os.listdir():获取指定目录下所有文件和文件夹的名字,数据列行为列表 2、os.re
        阅读全文
            
                    
                
浙公网安备 33010602011771号