text_file = "xxx.txt" with open(text_file) as f: lines = f.readlines() lines = [line.strip() for line in lines] print(lines)
out_text_file = "xxx.txt" with open(out_text_file, 'w') as f: print("writing to text file", file=f)
Ref. https://www.geeksforgeeks.org/writing-csv-files-in-python/
csvwriter只有writerow
方法,没有writecol
。原因应该是逗号分隔是行内分隔。
Ref. https://linuxhint.com/convert-jupyter-notebook-python/
pip install jupyter jupyter nbconvert xxx.ipynb --to python
https://towardsdatascience.com/how-to-load-matlab-mat-files-in-python-1f200e1287b5
from scipy.io import loadmat annots = loadmat('cars_train_annos.mat') print(annots.keys())