| | |
File Interactions
![]() |
Ok I was wondering if anyone could help me with how to make a python program interact with files. Copying, pasting, moving, things like that, opening. If it cant really be discussed quicky are there any good tutorials? Mainly a organinzing python program.(looks for a certain file extention, then moves it to a desegnated folder)
Advice and help grately apprecated :cheesy:
Advice and help grately apprecated :cheesy:
Blender is by far the best free 3D computer Graphics program and it is expandable with python! GoTo www.blender3d.org
Uh..... *drools*
Sorry but i am a noob with this and the only things I've made was a Hello World Program and a specilzied calcultor that does caluclations for the popular internet game Runescape.
Sorry but i am a noob with this and the only things I've made was a Hello World Program and a specilzied calcultor that does caluclations for the popular internet game Runescape.
Blender is by far the best free 3D computer Graphics program and it is expandable with python! GoTo www.blender3d.org
Here is a code snippet of a typical file copy ...
[php]# copy a file to another folder or to another filename
# copy2() retains original date/time, copy() does not
import shutil
# make sure folder and file exists
sourcefile = "D:/Python24/Atest/Audi.jpg"
# destination-folder has to exist
destinationfile = "C:/Temp/Audi.jpg"
try:
shutil.copy2(sourcefile, destinationfile)
except IOError:
print "File or folder does not exist!"
else:
print "File successfully copied!"
[/php]
[php]# copy a file to another folder or to another filename
# copy2() retains original date/time, copy() does not
import shutil
# make sure folder and file exists
sourcefile = "D:/Python24/Atest/Audi.jpg"
# destination-folder has to exist
destinationfile = "C:/Temp/Audi.jpg"
try:
shutil.copy2(sourcefile, destinationfile)
except IOError:
print "File or folder does not exist!"
else:
print "File successfully copied!"
[/php]
May 'the Google' be with you!
![]() |
Similar Threads
- connect to text file database (Visual Basic 4 / 5 / 6)
- pyWin32 & wxPython (Python)
- Importing SQL Script File - Urgent !! (Database Design)
- enabling file sharing (Windows NT / 2000 / XP)
- 81TB File Server (Networking Hardware Configuration)
Other Threads in the Python Forum
- Previous Thread: IP adresses
- Next Thread: ssh changes the way python script behaves
| Thread Tools | Search this Thread |
abrupt ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog cx-freeze data decimals dictionaries dictionary directory dynamic error examples exe file float format function gnu graphics gui heads homework http ideas import input itunes java launcher leftmouse line linux list lists loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite ssh statistics string strings sudokusolver sum table terminal text thread threading time tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable ventrilo wikipedia write wxpython xlib






