/zhqsystem/zhq 当前离线
中尉
@echo off&color 0e setlocal enabledelayedexpansion set "letter_lss=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" set "n_lss=0" set "n=0" for /f "delims=" %%i in ('type "%1"') do ( set "str=%%i" for %%j in (%letter_lss%) do ( set "str=!str:%%j=%%j!" set/a "n_lss+=1" if !n_lss! equ 26 ( if !n! lss 1 ( echo,首次进入清理同名数据重建_转换大写 echo,!str!>%~n1_转换大写%~x1 set/a n+=1 ) else if !n! geq 1 ( set/a n+=1 echo,第 !n! 次执行导出操作 echo=!str!>>%~n1_转换大写%~x1 ) set "n_lss=0" ) ) ) set "letter_gtr=a b c d e f g h i j k l m n o p q r s t u v w x y z" set "n_gtr=0" set "n=0" for /f "delims=" %%i in ('type "%1"') do ( set "str=%%i" for %%j in (%letter_gtr%) do ( set "str=!str:%%j=%%j!" set/a "n_gtr+=1" if !n_gtr! equ 26 ( if !n! lss 1 ( echo=首次进入清理同名数据重建_转换小写 echo=!str!>%~n1_转换小写%~x1 set/a n+=1 ) else if !n! geq 1 ( set/a n+=1 echo,第 !n! 次执行导出操作 echo=!str!>>%~n1_转换小写%~x1 ) set "n_gtr=0" ) ) ) pause复制代码
依山居 ( 伸手党去死,私信问问题的去死)当前离线
TOP
CrLf 当前离线
论坛巡查
'a' == 0x60 'A' == 0x40 0xff^0x20 == 0b11111011 0x20 == 0b00000100 'a' & (0xff^0x20) = 'A' 'A' | 0x20 = 'a'复制代码
评分人数
pcl_test 当前离线
荣誉版主
str='asdfsD1df' def l2u(str): ret='' for c in str: ret += chr(ord(c)&(0xff^0x20)) if c.isalpha() else c; return ret def u2l(str): ret='' for c in str: ret += chr(ord(c)|0x20) if c.isalpha() else c; return ret print (l2u(str)) print (u2l(str))复制代码
import string lowercase=string.ascii_lowercase uppercase=string.ascii_uppercase f=open("a.txt","r") def l2u(): txt=f.read() for r in range(0,26,1): txt=txt.replace(lowercase[r],uppercase[r]) return(txt) def u2l(): txt=f.read() for r in range(0,26,1): txt=txt.replace(uppercase[r],lowercase[r]) return(txt)复制代码