473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help with creating Python Session Files

Hi,

I want to create session files for my output.
And this data file will be stored in the server.

Thanks in Advance

So its like this

Expand|Select|Wrap|Line Numbers
  1.  
  2. ....
  3.  
  4. session_file= open(path/../cy2.sif)
  5. ....
  6. ....
  7.  
  8. print >>session_files, %s %s % (v[0] v[1])
  9.  
  10. v[0] and v[1] are some array consisting info to be written in cy2.sif file.
  11.  
  12.  
Can you please help me how can I create session for the file cy2.sif
Aug 26 '10 #1
3 1760
bvdet
2,851 Expert Mod 2GB
You cannot write to a file opened for reading. Open the file in "w" or "a" mode.
Expand|Select|Wrap|Line Numbers
  1. >>> f = open("foo.txt", 'w')
  2. >>> v = ((1,2),(10,20),(100,200))
  3. >>> for item in v:
  4. ...     print >> f, "%s %s" % item
  5. ...     
  6. >>> f.close()
  7. >>> 
In your code, the tuple that accompanies the format string is missing a comma.
Aug 27 '10 #2
thanks so much..

But how to make this files as session files
Aug 27 '10 #3
bvdet
2,851 Expert Mod 2GB
I don't know what a session file is. Can you provide more information or a detailed example?
Aug 29 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Spam sucks | last post by:
Hello, Could somebody explane to me how i can unserialize the content of a session file, i allready reading the session files and the content now i only need to unserialize the data in the...
3
by: Jerry Sievers | last post by:
Hello. I have session files stored in a special tmp directory specific to a virtual host instance. The Max_lifetime is long 86400 (1 day) which I don't suppose is the problem. Anyway the...
4
by: Spendwiser | last post by:
Hi! I noticed that the file permissions (unix) of the PHP session files have only read and write permissions for the Apache process (600 or rw- --- ---). Does anyone have any idea where this...
13
by: Nagib Abi Fadel | last post by:
Is it possible to create a session variable for each user in Postresql ?? Thx
1
by: Jonathan N. Little | last post by:
With all the security concerns and folks disabling JavaScript and cookies I converted my site to PHP. Originally I use session cookie to keep track of items our patrons selected on our gallery for...
37
by: John Salerno | last post by:
I contacted my domain host about how Python is implemented on their server, and got this response: ------------------- Hello John, Please be informed that the implementation of python in our...
3
by: ImOk | last post by:
I am using filebased sessions with and they get created in a folder called c:\php5apps\sessions I have cookies enabled. I clear the cookies, but when to the session files eventually get erased?...
0
by: Tarun Mistry | last post by:
Hi all, I'm trying to create a global object that can be used anywhere in my ASP.NET (2.0) application but im having problems. I would like to run some logic every time the page is loaded,...
3
by: Jonathan Mark | last post by:
Some languages, such as Scheme, permit you to make a transcript of an interactive console session. Is there a way to do that in Python?
17
by: Sunburned Surveyor | last post by:
I was thinking of a way I could make writing Python Class Files a little less painful. I was considering a Ptyhon script that read a file with a list of property names and method names and then...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.