Skip to content

Instantly share code, notes, and snippets.

View CodeBoy2006's full-sized avatar
📚
Learning CS and SE

codeboy CodeBoy2006

📚
Learning CS and SE
View GitHub Profile
@CodeBoy2006
CodeBoy2006 / String and BASE64.js
Created May 1, 2020 06:10
字符串与BASE64转换,Javascript 中文不报错不乱码
btoa(unescape(encodeURIComponent( string ))) //字符串转BASE64
atob(unescape(encodeURIComponent( string ))) //BASE64转字符串
@CodeBoy2006
CodeBoy2006 / Get_root_file_example.py
Last active March 19, 2020 14:20
Python 获取根目录示例,可以用在目录混乱的时候统一路径
# Python 获取根目录
#Windows
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = curPath[:curPath.find("myProject\\")+len("myProject\\")] # 获取myProject,也就是项目的根路径
dataPath = os.path.abspath(rootPath + 'data\\train.csv') # 获取tran.csv文件的路径
#Mac
import os