No project description provided
Project description
minhas funções mais utilizadas
def TipoArquivo(): try: a = (file[-2:]) return 'py' except: a = os.getcwd()[-2:] return 'jupter'
def LimparTela(self): if self.TipoArquivo() != 'py': pass else: os.system('cls')
def DeletarArquivo(caminho_arquivo): if os.path.exists(caminho_arquivo): os.remove(caminho_arquivo)
def CriarPasta(caminho_da_pasta): os.makedirs(caminho_da_pasta)
def Pasta_do_Arquivo(caminho_arquivo): return os.path.dirname(caminho_arquivo)
def Juntar(a, b): return os.path.join(a, b)
def Escrever_json(nomedodicionario, nomedoarquivo): if nomedoarquivo[-4:] != 'json': nomedoarquivo = nomedoarquivo+'.json' with open(nomedoarquivo, 'w') as f2: json.dump(nomedodicionario, f2, indent=4)
def Ler_json(nomedoarquivo): # retorna um dicionário if nomedoarquivo[-4:] != 'json': nomedoarquivo = nomedoarquivo+'.json' with open(nomedoarquivo, 'r') as f2: try: a = json.load(f2) return a except json.JSONDecodeError as e: print(f"Erro ao decodificar JSON: {e}") return {}
def Data(): current_time = datetime.now() formatted_time = current_time.strftime('%d-%m-%Y-%H:%M:%S') return formatted_time
def SalvarPickle(var, nome): if nome[-3:] != 'plk': nome = nome+'.plk' with open(nome+'.plk', 'wb') as arquivo: pickle.dump(var, arquivo)
def LerPickle(nome): if nome[-3:] != 'plk': nome = nome+'.plk' with open(nome+'.plk', 'rb') as arquivo: return pickle.load(arquivo)
def IniciarThread(funcao, argu = ''): if argu == '': Thread(target=funcao, daemon=True).start() else: Thread(target=funcao, arqgs = argu, daemon=True).start()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for funcoes_leo-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de4c89169a8acd44d5173fc4af1b54ad18474350b71a739934a6d9e6e589e87f |
|
MD5 | 0aeb2ea1e9ea6d5046e63dc26ea52649 |
|
BLAKE2b-256 | d6a36c10ab3e838232e5860543c4726b92110033c0a887c752cc3792c54b1630 |