1. @echo off & setlocal enableDelayedExpansion set a= set /p a=Please drag your txt file for split: cls :: %% 两个百分号 不带文件名后缀 for %%k in (%a%) do set wjm=%%~nk 2. 调用call echo %~nx1 set /p a=Please drag your txt file for split: call :getname !a! :getnam
#coding:utf8 if __name__ == '__main__': srcfile = u"D:/测试路径/测试文件.txt" f = open(srcfile.encode('gbk')) for text in f.readlines(): print text.decode('gbk') f.close()