-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparte4.py
More file actions
75 lines (58 loc) · 2.03 KB
/
parte4.py
File metadata and controls
75 lines (58 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
######################################################
# classes
######################################################
# class MinhaClasse:
# helloWorld = "Hello, World!"
# def __init__(self, nome):
# self.nome = nome
# def hello(self):
# print("Hello, %s" %self.nome)
# def whoAmI(self):
# return(self.nome)
# def batizar(self, novoNome):
# self.nome = novoNome
# if __name__ =='__main__':
# obj = MinhaClasse("Paulo")
# print(obj.helloWorld)
# meuNome = obj.whoAmI()
# print("Eu me chamo %s" %(meuNome))
# obj.hello()
# obj.batizar("Serra")
# meuNome = obj.whoAmI()
# print("Fui batizado como o novo nome: %s" %(meuNome))
# obj.hello()
######################################################
# arquivos
######################################################
# Abre o arquivo apenas para leitura
# f = open('inverte.txt', 'r')
# print(f.readline())
# print(f.readline())
# print(f.readline())
# print(f.readline())
# print(f.readline())
# print(f.readline())
# f.close()
# Nao precisa fechar o arquivo explicitamente
# with open('inverte.txt') as f:
# print(f.readlines())
######################################################
# datetime
######################################################
# import datetime
# print(datetime.datetime.now())
# print("Or like this: " ,datetime.datetime.now().strftime("%y-%m-%d-%H-%M"))
# print("Current year: ", datetime.date.today().strftime("%Y"))
# print("Month of year: ", datetime.date.today().strftime("%B"))
# print("Week number of the year: ", datetime.date.today().strftime("%W"))
# print("Weekday of the week: ", datetime.date.today().strftime("%w"))
# print("Day of year: ", datetime.date.today().strftime("%j"))
# print("Day of the month : ", datetime.date.today().strftime("%d"))
# print("Day of week: ", datetime.date.today().strftime("%A"))
# dt = datetime.datetime.now()
# print(dt.year)
# print(dt.microsecond)
# delta = datetime.timedelta(days = 100)
# hj = datetime.date.today()
# diff = hj - delta
# print(diff)