TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Python 3 programming language, learn python, tutorial

Previous articlePage bottomNext article  ALL TOPICS

Python 3. Module glob

 Search for file:
import glob

print(glob.glob('./[0-9].*'))

print(glob.glob('*.txt'))

print(glob.glob('?.gif'))

# v3.5
# print (glob.glob('**/*.txt', recursive=True))

# v3.5
# print (glob.glob('./**/', recursive=True))

--- 
Previous articlePage topNext article  ALL TOPICS


backup:
def backup(self):
dest='c:/python34/database_backup'
try:
os.mkdir(dest)
except FileExistsError:
pass
shutil.copy2('file.txt','database_backup')
time=str(datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
time='database_backup/file_backup_'+time+'.txt'
os.rename('database_backup/file.txt',time)
print("Rezervine kopija padaryta!\n\n",time)


2015-12-17 09:23:44

 Use username: Guest, Anonymous, Programmer






QUOTES:
I do not think I had ever seen a nastier-looking man. Under the black hat, when I had first seen them, the eyes had been those of an unsuccessful rapist.
Ernest Hemingway
Give little love to a child, and you get a great deal back.
John Ruskin
A customer who complains is my best friend.
Stew Leonard