科学网

 找回密码
  注册
python小脚本对原文件进行直接修改:删除、替换
赵志强 2019-10-15 16:16
replace.py
个人分类: Python|1916 次阅读|没有评论
python小脚本加应变
赵志强 2019-10-10 21:23
#!/usr/bin/python # -*- coding: UTF-8 -*- #by Zhiqiang-Zhao #import module ! import os import fileinput as fi import numpy as np import math #specify input and outputfile ! in_file= 'CONTCAR' out1_file='strain.vasp' for i in range ...
个人分类: Python|1861 次阅读|没有评论
[转载]Numpy高维数组的理解
赵志强 2019-9-24 10:01
转载: https://blog.csdn.net/nianzu_ethan_zheng/article/details/79038212 Reference: From Python Nested Lists to Multidimensional numpy Arrays Numpy高维数据的理解 当实际处理多维变量时,尤其需要使用到Tensorflow这样深度学习库,比如,图片数据批次其形状为: N×H×W×C , 高维序列格式存在难 ...
个人分类: Python|1815 次阅读|没有评论
python code LAMMPS轨迹文件格式转化
赵志强 2019-6-24 18:59
代码的目的是为了把xxx.lammps文件中的速度进行变换 提高:使用列表中元素的数目来对特征行进行匹配 #!/usr/bin/python #-*-coding:UTF-8-*- #byZhiqiang-ZhaoinNUAA #Email:ZhiqiangZhao@nuaa.edu.cn #importmodule! importos import&n ...
个人分类: Python|4121 次阅读|没有评论
Python selenium自动登录网站
赵志强 2019-6-19 19:37
首次尝试python爬虫,感觉不错: #!/usr/bin/python #-*-coding:UTF-8-*- #byZhiqiang-Zhao #email:zhiqiangzhao@nuaa.edu.cn #specifymodule! fromseleniumimportwebdriver fromselenium.common.exceptionsimportT ...
个人分类: Python|1982 次阅读|没有评论
Python小code对原文件进行替换
赵志强 2019-6-17 19:04
import os import fileinput with fileinput.input('tip.data',backup='.bak',inplace=True) as f: for line in f: line = line.rstrip().replace('0.417000','0.5564') &nb ...
个人分类: Python|1599 次阅读|没有评论
Python Numpy 创建数组
赵志强 2019-6-12 23:17
参考: https://www.runoob.com/numpy/numpy-array-from-existing-data.html numpy.empty numpy.empty 方法用来创建一个指定形状(shape)、数据类型(dtype)且未初始化的数组: numpy.empty(shape,dtype=float,order='C') shape 数组形状 dtype 数据类型, ...
个人分类: Python|2438 次阅读|没有评论
Python NumPy 数组属性
赵志强 2019-6-12 22:30
ndarray.ndim 秩,用于返回数组的维数 ndarray.shape 数组的维度,对于矩阵,n 行 m 列 ndarray.size 数组元素的总个数,相当于 .shape 中 n*m 的值 ndarray.dtype ndarray 对象的元素类型 ndarray.itemsize ndarray 对象中每个元素的大小,以字节为单位 ndarray.flags ndarray 对象的内存 ...
个人分类: Python|1832 次阅读|没有评论
NumPy 数据类型 dtype
赵志强 2019-6-12 22:03
本文参考自: https://www.runoob.com/numpy/numpy-dtype.html Numpy支持多种数据类型: bool_ 布尔型数据类型(True 或者 False) int_ 默认的整数类型(类似于 C 语言中的 long,int32 或 int64) intc 与 C 的 int 类型一样,一般是 int32 或 int 64 intp 用于索引的整数类型(类似于 C 的 ssize_t ...
个人分类: Python|7186 次阅读|没有评论

本页有 1 篇博文因作者的隐私设置或未通过审核而隐藏

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-25 22:54

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部