pusofalse 当前离线
荣誉版主
[Promise don't come easy] I should have known all along. There was something wrong. I just never read between the lines. Then I woke up one day and found you on your way. Leaving nothing but my heart behind. What can I do to make it up to you. Promises don't come easy. But tell me if there's a way to bring you back home to stay. Well I'd promises anything to you. I've been walkin' around with my head hanging down. Wondrin' what I'm gonna do. 'Cause when you walked out that door.复制代码
qixiaobin0715 当前在线
大校
@echo off setlocal enabledelayedexpansion for /l %%i in (1,1,40) do set "space=!space! " for /f "tokens=1* delims=:" %%a in ('findstr /o .* 1.txt') do ( if defined num2 ( set /a "num1=(%%a-!num2!)/2" call echo,%%str:~!num1!%% ) set num2=%%a set str=!space!%%b ) pause复制代码
TOP
taofan712 当前离线
六级士官
@echo off setlocal enabledelayedexpansion set "kong= " for /f "delims=" %%a in (a.txt) do ( setlocal for %%b in (%%a) do set /a n+=1 set /a num=80-n*4 set /a num=num/8 for /l %%c in (1,1,!num!) do set/p=%kong%<nul set/p=%%a<nul for /l %%c in (1,1,!num!) do set/p=%kong%<nul echo; endlocal ) pause复制代码
codegay 当前离线
少校
""" python文本内容居中显示.py http://bbs.bathome.net/thread-1289-1-1.html 2016年5月2日 04:51:33 codegay """ with open("a.txt") as f: txt=[r.strip() for r in f] w=max([len(r) for r in txt])+10 [print(r.center(w)) for r in txt]复制代码
designTech 当前离线
列兵
喃喃努努 当前离线
上等兵
biluncloud 当前离线
再来一个更简单的(no findstr no 逐字符 no tempfile no 变量延迟): [ 本帖最后由 batman 于 2008-8 ... batman 发表于 2008-8-2 09:15
netbenton (秋风夜雨)当前离线
@echo off&setlocal enabledelayedexpansion for /f "delims=" %%a in (a.txt) do (set "str=%%a" for /l %%b in (1,1,40) do (if "!str:~78!" equ "" set "str= !str! ") echo,!str:~,79! ) pause复制代码
评分人数
keen 当前离线
batman 当前离线
考官
@echo off for /f "delims=" %%i in (a.txt) do ( set v=%%i set str=%%i set n=0 call :lp ) pause&exit/b :lp set /a n+=1 set v=%v:~1% if not "%v%"=="" (goto lp) else (goto next) :next set /a m=(77-%n%)/2 for /l %%j in (1 1 %m%) do set /p= <nul echo %str% goto :eof复制代码
@echo off for /l %%i in (1,1,80) do call,set "kong=%%kong%% " for /f "delims=" %%i in (1.txt) do ( set "str=%%i%kong%" call,set "str=%%str:~,80%%" call,set "str=%%str:%%i=%%" call,set "str=%%str: = %%" call,echo %%str%%%%i ) pause>nul复制代码
more 当前离线
技术组成员
for /f "tokens=1,2* delims=: " %%i in ('findstr /n /o .* 2.txt') do ( ...复制代码
@echo off copy /y 1.txt 2.txt>nul echo.>>2.txt&echo end>>2.txt for /f "tokens=1,2* delims=: " %%i in ('findstr /n /o .* 2.txt') do ( set "_%%i=%%j"&set ".%%i=%%k" if %%i geq 2 call :lp %%i ) del /q 2.txt&pause>nul&goto :eof :lp set /a n=%1-1 set /a num=_%1-_%n%-2 set /a kl=(80-num)/2 for /l %%i in (1,1,%kl%) do set /p= <NUL call,set /p=%%.%n%%%<NUL&ECHO. 复制代码