python import windows文件路经
import sys
sys.path.append("E:\\python\\workspacepython\\PY001\\src\\testpy01")
import string01
string01.MyClass() ########################### below is source #############################
import copy class MyClass(object): def __init__(self):
print("----------string start ----------") a="Hello"
b="Python" print(a*3)
print(a[:]) print(b[0:3]) if('H' in a):
print("'H' in a")
else:
print("'H' not in a") print("his name is %s and age is %d !"%('Rojas',20)) print(len(a)) num =9
print("16 bit :%#x"% num)
print('8 bit :%#o'% num)
print('2 bit :',bin(num)) lambdas="abcdefghijklmnopqrstuvwxyz"
print(lambdas[::2]) print(lambdas.partition("i")) iarray=['1','5','6','8','9']
# str001='.'.join(iarray)
str001=''.join(iarray)
print(str001) # string.maketrans(intab, outtab]) maketrans() 方法用于创建字符映射的转换表,对于接受两个参数的最简单的调用方式,第一个参数是字符串,表示需要转换的字符,第二个参数也是字符串表示转换的目标。
# string.partition(str) 有点像 find()和 split()的结合体,从 str 出现的第一个位置起,把 字 符 串 string 分 成 一 个 3 元 素 的 元 组 (string_pre_str,str,string_post_str),如果 string 中不包含str 则 string_pre_str == string. # string.translate(str, del="") # 制作翻译表
bytes_tabtrans = bytes.maketrans(b'abcdefghijklmnopqrstuvwxyz', b'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
print(bytes_tabtrans)
# 转换为大写,并删除字母o
print(b'runoob'.translate(bytes_tabtrans, b'o')) trantab = str.maketrans(lambdas, lambdas.upper().replace('D', ' ') )
tragetstr=copy.copy(lambdas)
ph=tragetstr.translate(trantab)
print(ph)
python import windows文件路经的更多相关文章
- Python import其他文件夹的文件
一般情况下,import的文件和被import的文件在同一个路径下面,import也比较方便.如果这两个文件不在一个路径下面,import就比较麻烦了,需要在被import的文件路径下面新建一个__i ...
- python import其他文件夹下的模块
模块的路径不在默认搜索路径中,需要在sys.path中添加 import syssys.path.append('需要模块的文件夹路径')
- 如何用python在Windows系统下,生成UNIX格式文件
平时测试工作中,少不了制造测试数据.最近一个项目,我就需要制造一批可在UNIX下正确读取的文件.为确保这批文件能从FTP下载成功,开发叮嘱我:“文件中凡是遇到换行,换行符必须是UNIX下的LF,而不是 ...
- windows平台 python生成 pyd文件
Python的文件类型介绍: .py python的源代码文件 .pyc Python源代码import后,编译生成的字节码 .pyo Python源代码编译优化生成的字节 ...
- 利用python同步windows和linux文件
写python脚本的初衷,每次在windows编辑完文件后,想同步到linux上去,只能够登录服务器,然后再利用网络copy,重复性很大,就想着能不能写一个小脚本帮我同步 逻辑:比对本地和服务器文件的 ...
- Python引用(import)文件夹下的py文件的方法
Python的import包含文件功能就跟PHP的include类似,但更确切的说应该更像是PHP中的require,因为Python里的import只要目标不存在就报错程序无法往下执行.要包含目录里 ...
- windows下python调用c文件流程
1.新建fun.c文件和fun.h文件 #include <stdio.h> #include <stdlib.h> #include <string.h> int ...
- python安装whl文件的注意事项(windows系统)
首先给大家来一波福利,在没有连接外网(互联网)的情况下,只有公司内网或者断网情况下,需要安装python的一些依赖,不会操作的同学可能就会遇到麻烦.这里教大家离线安装python依赖. 方法:使用.w ...
- python import, from xx import yy
区别: 用import modulexx/packagexx.moduleyy是导入某一模块,如果想引用模块的内容(class, method,variables...)必须用全名,即 [module ...
随机推荐
- Popupwindow 显示, 其它背景变暗。 并加上点击事件 ~ (用于记录)
public class MainActivity extends Activity implements OnClickListener { protected int mScreenWidth; ...
- 虚拟化技术对照:Xen vs KVM
恒天云:http://www.hengtianyun.com/download-show-id-68.html 一.说明 本文主要从功能方面和性能方面对Xen和KVM对照分析,分析出其优缺点指导我们恒 ...
- hdu1276(士兵队列训练问题) java集合水过
点击打开链接 有人说这题属于栈或者队列,个人认为说集合应该比較准确点. Problem Description 某部队进行新兵队列训练,将新兵从一開始按顺序依次编号.并排成一行横队,训练的规则例如以下 ...
- Transformation in kentico
https://docs.kentico.com/k10/developing-websites/loading-and-displaying-data-on-websites/writing-tra ...
- 官方文档 Upgrading Elasticsearch
Upgrading Elasticsearch Before upgrading Elasticsearch: Consult the breaking changes docs. Use the E ...
- C#中的CSP(Communicating sequential processes)
说起Golang(后面统称为Go),就想到他的高并发特性,在深入一些就是 Goroutine.在大家被它优雅的语法和简洁的代码实现的高并发程序所折服时,其实C#/.NET也可以很容易的做到.今天我们来 ...
- Homebrew的安装及使用
Homebrew是Mac上的软件包管理工具,能在Mac中方便的搜索安装卸载软件. 1 安装 在终端输入一下代码,回车,即可下载. ruby -e "$(curl -fsSL https:/ ...
- LeetCode 1. Two Sum (c++ stl map)
题目:https://leetcode.com/problems/two-sum/description/ stl map代码: class Solution { public: vector< ...
- Java数据库连接——jdbc-odbc桥连接方式及汉字乱码问题
jdbc-odbc桥连接方式操作数据库SU(Course),其中Course属性有Cno,Cname,Cpno,Ccredit. 步骤: 1.配置数据源 控制面板下搜索管理工具->ODBC数据源 ...
- Thread-local storage
Thread-local storage (TLS) is a computer programming method that uses static or global memory local ...