fputs

Jugurtha Hadjar jugurtha.hadjar at gmail.com
Tue Jun 5 11:43:02 EDT 2012


On 06/05/2012 02:54 PM, hassan wrote:
> Dear ALL ,
>
> what is the equivalent to the php fputs in python
>
>
> regards,

Hello,

Have you tried something like this (I'll be passing the filename as an 
argument):


from sys import argv

script, dest_file = argv


data_to_write = raw_input()

output = open(dest_file, 'w')

output.write(data_to_write)



You can execute it this way:

python <script_name.py> <file_you_want_to_create>

e.g:

python script.py data.txt




-- 
~Jugurtha Hadjar,



More information about the Python-list mailing list