Hello there
Sorry in advance if this post is to big, not sure where else to go.

I have just started out with python (last 2wks) with no previous Programming background.
I have been really excited with the possibility of been able to program with python and to hopefully develop more coding languages as my knowledge base increases and to be involved in an IT orientated community.

Have been reading forums, how-to's, code snippets and also reading a few books
OReilly Learning Python 3rd Edition
Beginning Python - From Novice To Professional

I'm just having some problems with actually starting projects from scratch, I think my main problem is not knowing how to relate with real world environments as allot of the book projects are mathematical and just when the book touches on building database for query it pans off back to 5 ++ 6 \n . import random.random

where as the old MSDos batch file tutorials I can relate to, as they a practical :)
I'm currently running Python IDLE on Win32 platform and on Linux

I would like to eventually be able to convert some of my old batch files to python scripts.

This is something i hacked together as $dobe does not allow you do redistribute or download installer for authorwa player even tho on their website they say you can.

{{{ I know this is a bacth file :P }}}}

@echo off
Set srvr=%1

MKDIR \\%1\c$\Windows\System32\Macromed\Authorwa

Xcopy /y \\servername\ict$\Authorwa\*.* \\%1\C$\Windows\System32\Macromed\Authorwa

psexec -u \administrator -p pwd \\%1 regsvr32 /s C:\Windows\System32\Macromed\Authorwa\awswax.ocx
IF %ERRORLEVEL%==0 GOTO complete

Echo Congratulations mate setup of $dobe Authorware player on target machine has been successfull :)
Echo Please now Try the intended website to complete testing

I was hoping with someones assistance they could give me some friendly advice and direction not flat out giving me the answer but maybe coaching :) so as i can build from this more scope.

Thanks for reading

meet on the level part on the square

Ok I know some books with real world examples and even some examples. Have you passed through starting python sticky? It have real world examples from this forum members.

Also in python.org there is tutorial and great Links. Consider also google with keywords such as "python tutorials". I have found many tutorials to be real world related. Anyway the books Imainly read are free one Like Think Python, a byte of python, learning python ...etc


Let's try to translate a few key commands into Python...

Set srvr=%1
srvr = sys.argv[1]

sys.argv contains the list of input parameters. Index 0 ( [0] ) always contains the name of the program. Don't forget you'll need to [icode]import sys[/icode] to access this item.


time.sleep(1) tells execution of the script to pause for 1 second. The value in the parenthesis can be any number of seconds. Don't forget you'll need to

import time

to make use of this function.

MKDIR \\%1\c$\Windows\System32\Macromed\Authorwa

Xcopy /y \\servername\ict$\Authorwa\*.* \\%1\C$\Windows\System32\Macromed\Authorwa

os.makedir( )
os.system( )

The os module contains many interesting functions. makedir() does exactly what it sounds like, and system() allows you to execute system commands. The easiest way to perform a copy (in my opinion) is to simply do a system command.

If you're going for cross-platform compatibility then use something like:

 if sys.platform[:3] == 'win':
    os.system( 'xcopy %s %s' % ( from_path, to_path ) )
elif sys.platform[:5] == 'linux':    
    os.system( 'cp -r %s %s' % ( from_path, to_path ) )

I guess the rest is pretty straight forward; print statements and string formatting
Refer to this link if you don't know about the power of % (string formatting)

Thank you very much jlm699

Great layout easy to understand.
this has helped quite a fair bit, now i can build upon the information provided.