
Python
OldJohn86
虚其心,可解天下之问;专其心,可治天下之学;静其心,可悟天下之理;恒其心,可成天下之业
Python 学习推荐:
https://tushare.pro/register?reg=252370 分享此链接
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python3 实现C语言源文件.c/.h 代码宏定义解析与分离(拆解remove or 保留keep)
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' Author: OldJohn86 Date: 2019-10-10 ''' import re import sys import os from os import walk import argparse keywords = [ '#if', '#if ', ...原创 2019-10-16 11:59:53 · 1606 阅读 · 1 评论 -
python tftp login in scrpt
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import paramiko import os from configparser import ConfigParser # 读取配置文件获取服务器的登录信息 def read_ini(): info = dict() cf = ConfigParser() cf.r...原创 2018-09-12 18:36:29 · 396 阅读 · 0 评论 -
python ssh download target image from server host
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import paramiko import os from datetime import date from configparser import ConfigParser g3_image_url = 'http://192.168.65.235:18683/g3/' g3_imag...原创 2018-09-12 18:34:29 · 404 阅读 · 0 评论 -
17个新手常见Python运行时错误
当初学 Python 时,想要弄懂 Python 的错误信息的含义可能有点复杂。这里列出了常见的的一些让你程序 crash 的运行时错误。 1)忘记在 if , elif , else , for , while , class ,def 声明末尾添加 :(导致 “SyntaxError :invalid syntax”) 该错误将发生在类似如下代码中: if spam == 42原创 2015-11-25 19:56:28 · 504 阅读 · 0 评论 -
如何入门 Python 爬虫?
“入门”是良好的动机,但是可能作用缓慢。如果你手里或者脑子里有一个项目,那么实践起来你会被目标驱动,而不会像学习模块一样慢慢学习。 另外如果说知识体系里的每一个知识点是图里的点,依赖关系是边的话,那么这个图一定不是一个有向无环图。因为学习A的经验可以帮助你学习B。因此,你不需要学习怎么样“入门”,因为这样的“入门”点根本不存在!你需要学习的是怎么样做一个比较大的东西,在这个过程中,你会很快地转载 2015-08-18 15:17:15 · 472 阅读 · 0 评论 -
【已解决】Python脚本运行出现语法错误:IndentationError: unindent does not match any outer indentation level
【问题】 一个python脚本,本来都运行好好的,然后写了几行代码,而且也都确保每行都对齐了,但是运行的时候,却出现语法错误: IndentationError: unindent does not match any outer indentation level 【解决过程】 1.对于此错误,最常见的原因是,的确没有对齐。但是我根据错误提示的行数,去代码中看了下,没啥问题啊。原创 2015-06-12 17:23:55 · 1288 阅读 · 0 评论 -
Python内置的字符串处理函数整理
Python内置的字符串处理函数整理,收集常用的Python 内置的各种字符串处理 函数的使用方法 str='python String function' 生成字符串变量str='python String function' 字符串长度获取:len(str) 例:print '%s length=%d' % (str,len(str)) 字母处理 全部大写:str.upper(原创 2015-06-11 15:19:38 · 433 阅读 · 0 评论 -
Python Split函数的用法总结
字符串的split用法 说明: Python中没有字符类型的说法,只有字符串,这里所说的字符就是只包含一个字符的字符串!!! 这里这样写的原因只是为了方便理解,仅此而已。 由于敢接触Python,所以不保证以后还有没有其他用法,所以会在后面不断加入。。。 1.按某一个字符分割,如‘.’ ? 1 2 3 4 str = ('ww原创 2015-06-11 15:12:15 · 940 阅读 · 0 评论 -
【Python】strip函数
strip是trim掉字符串两边的空格。 lstrip, trim掉左边的空格 rstrip, trim掉右边的空格 strip ( s [ , chars ] ) Return a copy of the string with leading and trailing characters removed. If chars is omitted or N原创 2015-06-11 15:16:57 · 420 阅读 · 0 评论 -
python字符串字串查找 find和index方法
python 字符串查找有4个方法,1 find,2 index方法,3 rfind方法,4 rindex方法。 1 find()方法:查找子字符串,若找到返回从0开始的下标值,若找不到返回-1 info = 'abca' print info.find('a')##从下标0开始,查找在字符串里第一个出现的子串,返回结果:0 info = 'abca' print info.find('a'原创 2015-06-17 17:12:08 · 1013 阅读 · 0 评论 -
Python split()方法
描述 Python split()通过指定分隔符对字符串进行切片,如果参数num 有指定值,则仅分隔 num 个子字符串 语法 split()方法语法: str.split(str="", num=string.count(str)). 参数 str -- 分隔符,默认为空格。num -- 分割次数。 返回值 返回分割后的字符串列表。 实例 以下实例展示了split()函原创 2015-06-16 15:47:09 · 559 阅读 · 0 评论