python中文对齐_Python修改文本列对齐

letter ->

LadderScore0 ->

LadderScore1 ->

LadderScore2 ->

LadderScore3 ->

LadderScore4 ->

LadderScore5 ->

LadderScore6 ->

LadderScore7 ->

LadderScore8 ->

LadderScore9 ->

WeeklyDoneCount0 ->

WeeklyDoneCount1 ->

WeeklyDoneCount2 ->

WeeklyDoneCount3 ->

WeeklyDoneCount4 ->

WeeklyDoneCount5 ->

WeeklyDoneCount6 ->

WeeklyDoneCount7 ->

WeeklyDoneCount8 ->

WeeklyDoneCount9 ->

LastFPS0 ->

LastFPS1 ->

LastFPS2 ->

LastFPS3 ->

LastFPS4 ->

LastFPS5 ->

LastFPS6 ->

LastFPS7 ->

LastFPS8 ->

LastFPS9 ->

脚本内容如下#!/usr/bin/env python

#coding:utf-8

import os

format = ‘%-*s%-*s\n‘

file = open(‘a.txt‘,‘r‘)

f = open(‘file.txt‘,‘a‘)

all = ""

for i in file:

i=i.split(‘ ‘)

a = format % (20, i[0], 20, ‘->‘)

all += a

f.write(a)

f.close()

file.close()

print all

文件展示

wKioL1lCghLxQD18AAFnsgyiV-U524.png-wh_500x0-wm_3-wmp_4-s_1517373753.png

原文地址:http://yht1990.blog.51cto.com/9014030/1937288

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值