
python
半盏茶功夫
这个作者很懒,什么都没留下…
展开
-
重命名文件
#!/usr/bin/env python """ #!/usr/bin/env python """ @Filename: rename_file_by_sort.py """ import os import sys import getopt def main(argv): config_file = "" try: opts, args = getopt.getopt(sys.argv[1:], 'f:', ['file=']) except getopt.原创 2020-12-07 21:16:31 · 222 阅读 · 0 评论 -
python字符串Unicode和String互相转换
问题一: 将u'\u810f\u4e71'转换为'\u810f\u4e71' 方法: s_unicode = u'\u810f\u4e71' s_str = s_unicode.encode('unicode-escape').decode('string_escape') 问题二: 将'\u810f\u4e71'转换为u'\u810f\u4e71' 方法:s_str = '\u810f\...原创 2019-10-11 10:40:15 · 998 阅读 · 0 评论